From ca55f06573de044e7a22ea161b97339d707ba5e7 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 14 Jul 2020 19:36:54 +0000 Subject: [PATCH 1/2] Update from master --- .../src/Generated/CdnManagementClient.cs | 31 +- .../src/Generated/EndpointsOperations.cs | 18 +- .../EndpointsOperationsExtensions.cs | 36 +- .../src/Generated/ICdnManagementClient.cs | 26 + .../src/Generated/IEndpointsOperations.cs | 14 +- .../Generated/IManagedRuleSetsOperations.cs | 68 + .../src/Generated/IOriginGroupsOperations.cs | 300 ++++ .../src/Generated/IOriginsOperations.cs | 124 ++ .../src/Generated/IPoliciesOperations.cs | 237 +++ .../Generated/ManagedRuleSetsOperations.cs | 395 +++++ .../ManagedRuleSetsOperationsExtensions.cs | 87 + .../src/Generated/Models/ActionType.cs | 24 + .../src/Generated/Models/Algorithm.cs | 21 + .../src/Generated/Models/CdnEndpoint.cs | 51 + .../Models/CdnWebApplicationFirewallPolicy.cs | 163 ++ ...pplicationFirewallPolicyPatchParameters.cs | 57 + .../src/Generated/Models/CustomDomain.cs | 15 +- .../src/Generated/Models/CustomRule.cs | 135 ++ .../Models/CustomRuleEnabledState.cs | 22 + .../src/Generated/Models/CustomRuleList.cs | 53 + .../src/Generated/Models/DeepCreatedOrigin.cs | 131 +- .../Models/DeepCreatedOriginGroup.cs | 143 ++ .../src/Generated/Models/Endpoint.cs | 108 +- ...ametersWebApplicationFirewallPolicyLink.cs | 56 + .../Models/EndpointUpdateParameters.cs | 81 +- .../Generated/Models/HealthProbeParameters.cs | 103 ++ .../Models/HealthProbeRequestType.cs | 66 + .../Models/HttpErrorRangeParameters.cs | 87 + .../Models/KeyVaultSigningKeyParameters.cs | 134 ++ .../Generated/Models/ManagedRuleDefinition.cs | 60 + .../Models/ManagedRuleEnabledState.cs | 22 + .../Models/ManagedRuleGroupDefinition.cs | 71 + .../Models/ManagedRuleGroupOverride.cs | 89 + .../Generated/Models/ManagedRuleOverride.cs | 89 + .../src/Generated/Models/ManagedRuleSet.cs | 118 ++ .../Models/ManagedRuleSetDefinition.cs | 97 ++ .../Generated/Models/ManagedRuleSetList.cs | 53 + .../src/Generated/Models/MatchCondition.cs | 131 ++ .../src/Generated/Models/MatchVariable.cs | 29 + .../src/Generated/Models/OperatorModel.cs | 32 + .../src/Generated/Models/Origin.cs | 141 +- .../src/Generated/Models/OriginGroup.cs | 146 ++ .../Models/OriginGroupResourceState.cs | 23 + .../Models/OriginGroupUpdateParameters.cs | 125 ++ .../Models/OriginUpdateParameters.cs | 131 +- .../src/Generated/Models/ParamIndicator.cs | 23 + .../Generated/Models/PolicyEnabledState.cs | 22 + .../src/Generated/Models/PolicyMode.cs | 22 + .../Generated/Models/PolicyResourceState.cs | 26 + .../src/Generated/Models/PolicySettings.cs | 115 ++ .../Generated/Models/PrivateEndpointStatus.cs | 25 + .../src/Generated/Models/ProbeProtocol.cs | 66 + .../src/Generated/Models/ProvisioningState.cs | 23 + .../src/Generated/Models/RateLimitRule.cs | 97 ++ .../src/Generated/Models/RateLimitRuleList.cs | 53 + .../src/Generated/Models/ResourceReference.cs | 53 + .../Models/ResponseBasedDetectedErrorTypes.cs | 66 + ...onseBasedOriginErrorDetectionParameters.cs | 112 ++ .../src/Generated/Models/TransformType.cs | 26 + .../Models/UrlRewriteActionParameters.cs | 29 +- .../Models/UrlSigningActionParameters.cs | 120 ++ .../src/Generated/Models/UrlSigningKey.cs | 88 + .../Models/UrlSigningParamIdentifier.cs | 80 + .../src/Generated/OriginGroupsOperations.cs | 1488 +++++++++++++++++ .../OriginGroupsOperationsExtensions.cs | 487 ++++++ .../src/Generated/OriginsOperations.cs | 540 ++++++ .../Generated/OriginsOperationsExtensions.cs | 214 +++ .../src/Generated/PoliciesOperations.cs | 1396 ++++++++++++++++ .../Generated/PoliciesOperationsExtensions.cs | 364 ++++ .../Generated/SdkInfo_CdnManagementClient.cs | 34 +- 70 files changed, 9567 insertions(+), 145 deletions(-) create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IManagedRuleSetsOperations.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginGroupsOperations.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IPoliciesOperations.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperations.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperationsExtensions.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ActionType.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Algorithm.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnEndpoint.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicy.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatchParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRule.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleEnabledState.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleList.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeRequestType.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HttpErrorRangeParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/KeyVaultSigningKeyParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleDefinition.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleEnabledState.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupOverride.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleOverride.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSet.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetList.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchCondition.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchVariable.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OperatorModel.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroup.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupResourceState.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupUpdateParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ParamIndicator.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyEnabledState.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyMode.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyResourceState.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicySettings.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PrivateEndpointStatus.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProbeProtocol.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRule.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRuleList.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResourceReference.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedDetectedErrorTypes.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/TransformType.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningActionParameters.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningKey.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningParamIdentifier.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperations.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperationsExtensions.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperations.cs create mode 100644 sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperationsExtensions.cs diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs index 758347f418a3..3af572321c4c 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/CdnManagementClient.cs @@ -59,6 +59,17 @@ public partial class CdnManagementClient : ServiceClient, I /// public string ApiVersion { get; private set; } + /// + /// Azure Subscription ID. + /// + public string SubscriptionId1 { get; set; } + + /// + /// Version of the API to be used with the client request. Current version is + /// 2017-04-02. + /// + public string ApiVersion1 { get; set; } + /// /// The preferred language for the response. /// @@ -92,6 +103,11 @@ public partial class CdnManagementClient : ServiceClient, I /// public virtual IOriginsOperations Origins { get; private set; } + /// + /// Gets the IOriginGroupsOperations. + /// + public virtual IOriginGroupsOperations OriginGroups { get; private set; } + /// /// Gets the ICustomDomainsOperations. /// @@ -112,6 +128,16 @@ public partial class CdnManagementClient : ServiceClient, I /// public virtual IEdgeNodesOperations EdgeNodes { get; private set; } + /// + /// Gets the IPoliciesOperations. + /// + public virtual IPoliciesOperations Policies { get; private set; } + + /// + /// Gets the IManagedRuleSetsOperations. + /// + public virtual IManagedRuleSetsOperations ManagedRuleSets { get; private set; } + /// /// Initializes a new instance of the CdnManagementClient class. /// @@ -356,12 +382,15 @@ private void Initialize() Profiles = new ProfilesOperations(this); Endpoints = new EndpointsOperations(this); Origins = new OriginsOperations(this); + OriginGroups = new OriginGroupsOperations(this); CustomDomains = new CustomDomainsOperations(this); ResourceUsage = new ResourceUsageOperations(this); Operations = new Operations(this); EdgeNodes = new EdgeNodesOperations(this); + Policies = new PoliciesOperations(this); + ManagedRuleSets = new ManagedRuleSetsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-04-15"; + ApiVersion = "2020-04-15"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperations.cs index c2e58d29e71e..fec815fba377 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperations.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperations.cs @@ -503,10 +503,11 @@ internal EndpointsOperations(CdnManagementClient client) /// /// Updates an existing CDN endpoint with the specified endpoint name under the - /// specified subscription, resource group and profile. Only tags and Origin - /// HostHeader can be updated after creating an endpoint. To update origins, - /// use the Update Origin operation. To update custom domains, use the Update - /// Custom Domain operation. + /// specified subscription, resource group and profile. Only tags can be + /// updated after creating an endpoint. To update origins, use the Update + /// Origin operation. To update origin groups, use the Update Origin group + /// operation. To update custom domains, use the Update Custom Domain + /// operation. /// /// /// Name of the Resource group within the Azure subscription. @@ -1390,10 +1391,11 @@ internal EndpointsOperations(CdnManagementClient client) /// /// Updates an existing CDN endpoint with the specified endpoint name under the - /// specified subscription, resource group and profile. Only tags and Origin - /// HostHeader can be updated after creating an endpoint. To update origins, - /// use the Update Origin operation. To update custom domains, use the Update - /// Custom Domain operation. + /// specified subscription, resource group and profile. Only tags can be + /// updated after creating an endpoint. To update origins, use the Update + /// Origin operation. To update origin groups, use the Update Origin group + /// operation. To update custom domains, use the Update Custom Domain + /// operation. /// /// /// Name of the Resource group within the Azure subscription. diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperationsExtensions.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperationsExtensions.cs index 8af256e29cda..8a422dc0a185 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperationsExtensions.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/EndpointsOperationsExtensions.cs @@ -167,10 +167,11 @@ public static Endpoint Create(this IEndpointsOperations operations, string resou /// /// Updates an existing CDN endpoint with the specified endpoint name under the - /// specified subscription, resource group and profile. Only tags and Origin - /// HostHeader can be updated after creating an endpoint. To update origins, - /// use the Update Origin operation. To update custom domains, use the Update - /// Custom Domain operation. + /// specified subscription, resource group and profile. Only tags can be + /// updated after creating an endpoint. To update origins, use the Update + /// Origin operation. To update origin groups, use the Update Origin group + /// operation. To update custom domains, use the Update Custom Domain + /// operation. /// /// /// The operations group for this extension method. @@ -194,10 +195,11 @@ public static Endpoint Update(this IEndpointsOperations operations, string resou /// /// Updates an existing CDN endpoint with the specified endpoint name under the - /// specified subscription, resource group and profile. Only tags and Origin - /// HostHeader can be updated after creating an endpoint. To update origins, - /// use the Update Origin operation. To update custom domains, use the Update - /// Custom Domain operation. + /// specified subscription, resource group and profile. Only tags can be + /// updated after creating an endpoint. To update origins, use the Update + /// Origin operation. To update origin groups, use the Update Origin group + /// operation. To update custom domains, use the Update Custom Domain + /// operation. /// /// /// The operations group for this extension method. @@ -622,10 +624,11 @@ public static Endpoint BeginCreate(this IEndpointsOperations operations, string /// /// Updates an existing CDN endpoint with the specified endpoint name under the - /// specified subscription, resource group and profile. Only tags and Origin - /// HostHeader can be updated after creating an endpoint. To update origins, - /// use the Update Origin operation. To update custom domains, use the Update - /// Custom Domain operation. + /// specified subscription, resource group and profile. Only tags can be + /// updated after creating an endpoint. To update origins, use the Update + /// Origin operation. To update origin groups, use the Update Origin group + /// operation. To update custom domains, use the Update Custom Domain + /// operation. /// /// /// The operations group for this extension method. @@ -649,10 +652,11 @@ public static Endpoint BeginUpdate(this IEndpointsOperations operations, string /// /// Updates an existing CDN endpoint with the specified endpoint name under the - /// specified subscription, resource group and profile. Only tags and Origin - /// HostHeader can be updated after creating an endpoint. To update origins, - /// use the Update Origin operation. To update custom domains, use the Update - /// Custom Domain operation. + /// specified subscription, resource group and profile. Only tags can be + /// updated after creating an endpoint. To update origins, use the Update + /// Origin operation. To update origin groups, use the Update Origin group + /// operation. To update custom domains, use the Update Custom Domain + /// operation. /// /// /// The operations group for this extension method. diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs index 3e0151ba28af..85ac3e7c2adf 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ICdnManagementClient.cs @@ -55,6 +55,17 @@ public partial interface ICdnManagementClient : System.IDisposable /// string ApiVersion { get; } + /// + /// Azure Subscription ID. + /// + string SubscriptionId1 { get; set; } + + /// + /// Version of the API to be used with the client request. Current + /// version is 2017-04-02. + /// + string ApiVersion1 { get; set; } + /// /// The preferred language for the response. /// @@ -89,6 +100,11 @@ public partial interface ICdnManagementClient : System.IDisposable /// IOriginsOperations Origins { get; } + /// + /// Gets the IOriginGroupsOperations. + /// + IOriginGroupsOperations OriginGroups { get; } + /// /// Gets the ICustomDomainsOperations. /// @@ -109,6 +125,16 @@ public partial interface ICdnManagementClient : System.IDisposable /// IEdgeNodesOperations EdgeNodes { get; } + /// + /// Gets the IPoliciesOperations. + /// + IPoliciesOperations Policies { get; } + + /// + /// Gets the IManagedRuleSetsOperations. + /// + IManagedRuleSetsOperations ManagedRuleSets { get; } + /// /// Check the availability of a resource name. This is needed for /// resources where name is globally unique, such as a CDN endpoint. diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IEndpointsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IEndpointsOperations.cs index 90a0e9c1ff0a..a48e98ef7539 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IEndpointsOperations.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IEndpointsOperations.cs @@ -112,9 +112,10 @@ public partial interface IEndpointsOperations /// /// Updates an existing CDN endpoint with the specified endpoint name /// under the specified subscription, resource group and profile. Only - /// tags and Origin HostHeader can be updated after creating an - /// endpoint. To update origins, use the Update Origin operation. To - /// update custom domains, use the Update Custom Domain operation. + /// tags can be updated after creating an endpoint. To update origins, + /// use the Update Origin operation. To update origin groups, use the + /// Update Origin group operation. To update custom domains, use the + /// Update Custom Domain operation. /// /// /// Name of the Resource group within the Azure subscription. @@ -380,9 +381,10 @@ public partial interface IEndpointsOperations /// /// Updates an existing CDN endpoint with the specified endpoint name /// under the specified subscription, resource group and profile. Only - /// tags and Origin HostHeader can be updated after creating an - /// endpoint. To update origins, use the Update Origin operation. To - /// update custom domains, use the Update Custom Domain operation. + /// tags can be updated after creating an endpoint. To update origins, + /// use the Update Origin operation. To update origin groups, use the + /// Update Origin group operation. To update custom domains, use the + /// Update Custom Domain operation. /// /// /// Name of the Resource group within the Azure subscription. diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IManagedRuleSetsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IManagedRuleSetsOperations.cs new file mode 100644 index 000000000000..05c9808d43f9 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn +{ + 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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginGroupsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginGroupsOperations.cs new file mode 100644 index 000000000000..dbfdaf4632bc --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginGroupsOperations.cs @@ -0,0 +1,300 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OriginGroupsOperations operations. + /// + public partial interface IOriginGroupsOperations + { + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// 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>> ListByEndpointWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// 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>> ListByEndpointNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginsOperations.cs index 020a8201e408..a2143cced76a 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginsOperations.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IOriginsOperations.cs @@ -83,6 +83,40 @@ public partial interface IOriginsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Origin origin, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Updates an existing origin within an endpoint. /// /// @@ -117,6 +151,68 @@ public partial interface IOriginsOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, OriginUpdateParameters originUpdateProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Origin origin, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Updates an existing origin within an endpoint. /// /// @@ -151,6 +247,34 @@ public partial interface IOriginsOperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, OriginUpdateParameters originUpdateProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists all of the existing origins within an endpoint. /// /// diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IPoliciesOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IPoliciesOperations.cs new file mode 100644 index 000000000000..770a55698172 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/IPoliciesOperations.cs @@ -0,0 +1,237 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PoliciesOperations operations. + /// + public partial interface IPoliciesOperations + { + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve protection policy with specified name within a resource + /// group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update policy with specified rule set name within a + /// resource group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the + /// specified policy name under the specified subscription and resource + /// group + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes Policy + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update policy with specified rule set name within a + /// resource group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// 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 resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the + /// specified policy name under the specified subscription and resource + /// group + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperations.cs new file mode 100644 index 000000000000..2e2943428c72 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperations.cs @@ -0,0 +1,395 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + 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(CdnManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CdnManagementClient + /// + public CdnManagementClient 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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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.Cdn/CdnWebApplicationFirewallManagedRuleSets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperationsExtensions.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/ManagedRuleSetsOperationsExtensions.cs new file mode 100644 index 000000000000..ff64d37500b4 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn +{ + 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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ActionType.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..4bb5f380aee8 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ActionType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + + /// + /// Defines values for ActionType. + /// + 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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Algorithm.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Algorithm.cs new file mode 100644 index 000000000000..898722f03108 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Algorithm.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + + /// + /// Defines values for Algorithm. + /// + public static class Algorithm + { + public const string SHA256 = "SHA256"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnEndpoint.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnEndpoint.cs new file mode 100644 index 000000000000..5846030d5434 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnEndpoint.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.Cdn.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the ARM Resource ID for the linked endpoints + /// + public partial class CdnEndpoint + { + /// + /// Initializes a new instance of the CdnEndpoint class. + /// + public CdnEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CdnEndpoint class. + /// + /// ARM Resource ID string. + public CdnEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM Resource ID string. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicy.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicy.cs new file mode 100644 index 000000000000..31d0d1e2215b --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicy.cs @@ -0,0 +1,163 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.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 for Azure CDN. + /// + [Rest.Serialization.JsonTransformation] + public partial class CdnWebApplicationFirewallPolicy : TrackedResource + { + /// + /// Initializes a new instance of the CdnWebApplicationFirewallPolicy + /// class. + /// + public CdnWebApplicationFirewallPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CdnWebApplicationFirewallPolicy + /// class. + /// + /// Resource location. + /// The pricing tier (defines a CDN provider, feature + /// list and rate) of the CdnWebApplicationFirewallPolicy. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Describes policySettings for + /// policy + /// Describes rate limit rules inside the + /// policy. + /// Describes custom rules inside the + /// policy. + /// Describes managed rules inside the + /// policy. + /// Describes Azure CDN endpoints + /// associated with this Web Application Firewall policy. + /// Provisioning state of the + /// WebApplicationFirewallPolicy. Possible values include: 'Creating', + /// 'Succeeded', 'Failed' + /// Resource status of the policy. + /// Gets a unique read-only string that changes + /// whenever the resource is updated. + public CdnWebApplicationFirewallPolicy(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), PolicySettings policySettings = default(PolicySettings), RateLimitRuleList rateLimitRules = default(RateLimitRuleList), CustomRuleList customRules = default(CustomRuleList), ManagedRuleSetList managedRules = default(ManagedRuleSetList), IList endpointLinks = default(IList), string provisioningState = default(string), string resourceState = default(string), string etag = default(string)) + : base(location, id, name, type, tags) + { + PolicySettings = policySettings; + RateLimitRules = rateLimitRules; + CustomRules = customRules; + ManagedRules = managedRules; + EndpointLinks = endpointLinks; + ProvisioningState = provisioningState; + ResourceState = resourceState; + Etag = etag; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes policySettings for policy + /// + [JsonProperty(PropertyName = "properties.policySettings")] + public PolicySettings PolicySettings { get; set; } + + /// + /// Gets or sets describes rate limit rules inside the policy. + /// + [JsonProperty(PropertyName = "properties.rateLimitRules")] + public RateLimitRuleList RateLimitRules { 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 Azure CDN endpoints associated with this Web + /// Application Firewall policy. + /// + [JsonProperty(PropertyName = "properties.endpointLinks")] + public IList EndpointLinks { get; private set; } + + /// + /// Gets provisioning state of the WebApplicationFirewallPolicy. + /// Possible values include: 'Creating', 'Succeeded', 'Failed' + /// + [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; } + + /// + /// Gets or sets the pricing tier (defines a CDN provider, feature list + /// and rate) of the CdnWebApplicationFirewallPolicy. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + if (PolicySettings != null) + { + PolicySettings.Validate(); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatchParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatchParameters.cs new file mode 100644 index 000000000000..418181bc9645 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CdnWebApplicationFirewallPolicyPatchParameters.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties required to update a CdnWebApplicationFirewallPolicy. + /// + public partial class CdnWebApplicationFirewallPolicyPatchParameters : IResource + { + /// + /// Initializes a new instance of the + /// CdnWebApplicationFirewallPolicyPatchParameters class. + /// + public CdnWebApplicationFirewallPolicyPatchParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CdnWebApplicationFirewallPolicyPatchParameters class. + /// + /// CdnWebApplicationFirewallPolicy tags + public CdnWebApplicationFirewallPolicyPatchParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets cdnWebApplicationFirewallPolicy tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomDomain.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomDomain.cs index b7d2a9ebea58..07f741dd671d 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomDomain.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomDomain.cs @@ -53,22 +53,19 @@ public CustomDomain() /// 'DomainControlValidationRequestTimedOut', 'IssuingCertificate', /// 'DeployingCertificate', 'CertificateDeployed', /// 'DeletingCertificate', 'CertificateDeleted' - /// Certificate parameters for - /// securing custom HTTPS /// Special validation or data may be /// required when delivering CDN to some regions due to local /// compliance reasons. E.g. ICP license number of a custom domain is /// required to deliver content in China. /// Provisioning status of the custom /// domain. - public CustomDomain(string hostName, string id = default(string), string name = default(string), string type = default(string), string resourceState = default(string), string customHttpsProvisioningState = default(string), string customHttpsProvisioningSubstate = default(string), CustomDomainHttpsParameters customHttpsParameters = default(CustomDomainHttpsParameters), string validationData = default(string), string provisioningState = default(string)) + public CustomDomain(string hostName, string id = default(string), string name = default(string), string type = default(string), string resourceState = default(string), string customHttpsProvisioningState = default(string), string customHttpsProvisioningSubstate = default(string), string validationData = default(string), string provisioningState = default(string)) : base(id, name, type) { HostName = hostName; ResourceState = resourceState; CustomHttpsProvisioningState = customHttpsProvisioningState; CustomHttpsProvisioningSubstate = customHttpsProvisioningSubstate; - CustomHttpsParameters = customHttpsParameters; ValidationData = validationData; ProvisioningState = provisioningState; CustomInit(); @@ -115,12 +112,6 @@ public CustomDomain() [JsonProperty(PropertyName = "properties.customHttpsProvisioningSubstate")] public string CustomHttpsProvisioningSubstate { get; private set; } - /// - /// Gets or sets certificate parameters for securing custom HTTPS - /// - [JsonProperty(PropertyName = "properties.customHttpsParameters")] - public CustomDomainHttpsParameters CustomHttpsParameters { get; set; } - /// /// Gets or sets special validation or data may be required when /// delivering CDN to some regions due to local compliance reasons. @@ -148,10 +139,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "HostName"); } - if (CustomHttpsParameters != null) - { - CustomHttpsParameters.Validate(); - } } } } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRule.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRule.cs new file mode 100644 index 000000000000..8e45521c784a --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRule.cs @@ -0,0 +1,135 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the common attributes for a custom rule that can be included in + /// a waf policy + /// + public partial class CustomRule + { + /// + /// Initializes a new instance of the CustomRule class. + /// + public CustomRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomRule class. + /// + /// Defines the name of the custom rule + /// Defines in what order this rule be evaluated + /// in the overall list of custom rules + /// List of match conditions. + /// Describes what action to be applied when rule + /// matches. Possible values include: 'Allow', 'Block', 'Log', + /// 'Redirect' + /// Describes if the custom rule is in + /// enabled or disabled state. Defaults to Enabled if not specified. + /// Possible values include: 'Disabled', 'Enabled' + public CustomRule(string name, int priority, IList matchConditions, string action, string enabledState = default(string)) + { + Name = name; + EnabledState = enabledState; + Priority = priority; + MatchConditions = matchConditions; + Action = action; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the name of the custom rule + /// + [JsonProperty(PropertyName = "name")] + public string Name { 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 defines in what order this rule be evaluated in the + /// overall list of custom rules + /// + [JsonProperty(PropertyName = "priority")] + public int Priority { get; set; } + + /// + /// Gets or sets list of match conditions. + /// + [JsonProperty(PropertyName = "matchConditions")] + public IList MatchConditions { get; set; } + + /// + /// 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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (MatchConditions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MatchConditions"); + } + if (Action == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Action"); + } + if (Priority > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 1000); + } + if (Priority < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 0); + } + if (MatchConditions != null) + { + foreach (var element in MatchConditions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleEnabledState.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleEnabledState.cs new file mode 100644 index 000000000000..b38f931179b1 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleEnabledState.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.Cdn.Models +{ + + /// + /// Defines values for CustomRuleEnabledState. + /// + public static class CustomRuleEnabledState + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleList.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleList.cs new file mode 100644 index 000000000000..7cf356bc6594 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/CustomRuleList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines contents of custom rules + /// + public partial class CustomRuleList + { + /// + /// Initializes a new instance of the CustomRuleList class. + /// + public CustomRuleList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomRuleList class. + /// + /// List of rules + public CustomRuleList(IList rules = default(IList)) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of rules + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOrigin.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOrigin.cs index 619563f1fd2d..22def4861a22 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOrigin.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOrigin.cs @@ -34,19 +34,54 @@ public DeepCreatedOrigin() /// /// Initializes a new instance of the DeepCreatedOrigin class. /// - /// Origin name + /// Origin name which must be unique within the + /// endpoint. /// The address of the origin. It can be a - /// domain name, IPv4 address, or IPv6 address. + /// domain name, IPv4 address, or IPv6 address. This should be unique + /// across all origins in an endpoint. /// The value of the HTTP port. Must be between - /// 1 and 65535 + /// 1 and 65535. /// The value of the HTTPS port. Must be - /// between 1 and 65535 - public DeepCreatedOrigin(string name, string hostName, int? httpPort = default(int?), int? httpsPort = default(int?)) + /// between 1 and 65535. + /// The host header value sent to the + /// origin with each request. If you leave this blank, the request + /// hostname determines this value. Azure CDN origins, such as Web + /// Apps, Blob Storage, and Cloud Services require this host header + /// value to match the origin hostname by default. + /// Priority of origin in given origin group for + /// load balancing. Higher priorities will not be used for load + /// balancing if any lower priority origin is healthy.Must be between 1 + /// and 5. + /// Weight of the origin in given origin group for + /// load balancing. Must be between 1 and 1000 + /// Origin is enabled for load balancing or not. + /// By default, origin is always enabled. + /// The Alias of the Private Link + /// resource. Populating this optional field indicates that this origin + /// is 'Private' + /// The Resource Id of the Private + /// Link resource. Populating this optional field indicates that this + /// backend is 'Private' + /// The location of the Private Link + /// resource. Required only if 'privateLinkResourceId' is + /// populated + /// A custom message to be + /// included in the approval request to connect to the Private + /// Link. + public DeepCreatedOrigin(string name, string hostName, int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string)) { Name = name; HostName = hostName; HttpPort = httpPort; HttpsPort = httpsPort; + OriginHostHeader = originHostHeader; + Priority = priority; + Weight = weight; + Enabled = enabled; + PrivateLinkAlias = privateLinkAlias; + PrivateLinkResourceId = privateLinkResourceId; + PrivateLinkLocation = privateLinkLocation; + PrivateLinkApprovalMessage = privateLinkApprovalMessage; CustomInit(); } @@ -56,32 +91,94 @@ public DeepCreatedOrigin() partial void CustomInit(); /// - /// Gets or sets origin name + /// Gets or sets origin name which must be unique within the endpoint. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets the address of the origin. It can be a domain name, - /// IPv4 address, or IPv6 address. + /// IPv4 address, or IPv6 address. This should be unique across all + /// origins in an endpoint. /// [JsonProperty(PropertyName = "properties.hostName")] public string HostName { get; set; } /// /// Gets or sets the value of the HTTP port. Must be between 1 and - /// 65535 + /// 65535. /// [JsonProperty(PropertyName = "properties.httpPort")] public int? HttpPort { get; set; } /// /// Gets or sets the value of the HTTPS port. Must be between 1 and - /// 65535 + /// 65535. /// [JsonProperty(PropertyName = "properties.httpsPort")] public int? HttpsPort { get; set; } + /// + /// Gets or sets the host header value sent to the origin with each + /// request. If you leave this blank, the request hostname determines + /// this value. Azure CDN origins, such as Web Apps, Blob Storage, and + /// Cloud Services require this host header value to match the origin + /// hostname by default. + /// + [JsonProperty(PropertyName = "properties.originHostHeader")] + public string OriginHostHeader { get; set; } + + /// + /// Gets or sets priority of origin in given origin group for load + /// balancing. Higher priorities will not be used for load balancing if + /// any lower priority origin is healthy.Must be between 1 and 5. + /// + [JsonProperty(PropertyName = "properties.priority")] + public int? Priority { get; set; } + + /// + /// Gets or sets weight of the origin in given origin group for load + /// balancing. Must be between 1 and 1000 + /// + [JsonProperty(PropertyName = "properties.weight")] + public int? Weight { get; set; } + + /// + /// Gets or sets origin is enabled for load balancing or not. By + /// default, origin is always enabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the Alias of the Private Link resource. Populating + /// this optional field indicates that this origin is 'Private' + /// + [JsonProperty(PropertyName = "properties.privateLinkAlias")] + public string PrivateLinkAlias { get; set; } + + /// + /// Gets or sets the Resource Id of the Private Link resource. + /// Populating this optional field indicates that this backend is + /// 'Private' + /// + [JsonProperty(PropertyName = "properties.privateLinkResourceId")] + public string PrivateLinkResourceId { get; set; } + + /// + /// Gets or sets the location of the Private Link resource. Required + /// only if 'privateLinkResourceId' is populated + /// + [JsonProperty(PropertyName = "properties.privateLinkLocation")] + public string PrivateLinkLocation { get; set; } + + /// + /// Gets or sets a custom message to be included in the approval + /// request to connect to the Private Link. + /// + [JsonProperty(PropertyName = "properties.privateLinkApprovalMessage")] + public string PrivateLinkApprovalMessage { get; set; } + /// /// Validate the object. /// @@ -114,6 +211,22 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "HttpsPort", 1); } + if (Priority > 5) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 5); + } + if (Priority < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 1); + } + if (Weight > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Weight", 1000); + } + if (Weight < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 1); + } } } } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs new file mode 100644 index 000000000000..af5491679ff1 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/DeepCreatedOriginGroup.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The origin group for CDN content which is added when creating a CDN + /// endpoint. Traffic is sent to the origins within the origin group based + /// on origin health. + /// + [Rest.Serialization.JsonTransformation] + public partial class DeepCreatedOriginGroup : IResource + { + /// + /// Initializes a new instance of the DeepCreatedOriginGroup class. + /// + public DeepCreatedOriginGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeepCreatedOriginGroup class. + /// + /// Origin group name which must be unique within + /// the endpoint. + /// The source of the content being delivered via + /// CDN within given origin group. + /// Health probe settings to the + /// origin that is used to determine the health of the origin. + /// Time + /// in minutes to shift the traffic to the endpoint gradually when an + /// unhealthy endpoint comes healthy or a new endpoint is added. + /// Default is 10 mins. This property is currently not + /// supported. + /// The JSON + /// object that contains the properties to determine origin health + /// using real requests/responses.This property is currently not + /// supported. + public DeepCreatedOriginGroup(string name, IList origins, HealthProbeParameters healthProbeSettings = default(HealthProbeParameters), int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes = default(int?), ResponseBasedOriginErrorDetectionParameters responseBasedOriginErrorDetectionSettings = default(ResponseBasedOriginErrorDetectionParameters)) + { + Name = name; + HealthProbeSettings = healthProbeSettings; + Origins = origins; + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes; + ResponseBasedOriginErrorDetectionSettings = responseBasedOriginErrorDetectionSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets origin group name which must be unique within the + /// endpoint. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets health probe settings to the origin that is used to + /// determine the health of the origin. + /// + [JsonProperty(PropertyName = "properties.healthProbeSettings")] + public HealthProbeParameters HealthProbeSettings { get; set; } + + /// + /// Gets or sets the source of the content being delivered via CDN + /// within given origin group. + /// + [JsonProperty(PropertyName = "properties.origins")] + public IList Origins { get; set; } + + /// + /// Gets or sets time in minutes to shift the traffic to the endpoint + /// gradually when an unhealthy endpoint comes healthy or a new + /// endpoint is added. Default is 10 mins. This property is currently + /// not supported. + /// + [JsonProperty(PropertyName = "properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes")] + public int? TrafficRestorationTimeToHealedOrNewEndpointsInMinutes { get; set; } + + /// + /// Gets or sets the JSON object that contains the properties to + /// determine origin health using real requests/responses.This property + /// is currently not supported. + /// + [JsonProperty(PropertyName = "properties.responseBasedOriginErrorDetectionSettings")] + public ResponseBasedOriginErrorDetectionParameters ResponseBasedOriginErrorDetectionSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Origins == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Origins"); + } + if (HealthProbeSettings != null) + { + HealthProbeSettings.Validate(); + } + if (TrafficRestorationTimeToHealedOrNewEndpointsInMinutes > 50) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", 50); + } + if (TrafficRestorationTimeToHealedOrNewEndpointsInMinutes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", 0); + } + if (ResponseBasedOriginErrorDetectionSettings != null) + { + ResponseBasedOriginErrorDetectionSettings.Validate(); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Endpoint.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Endpoint.cs index e1f3d0ae41b8..5d347d7607e5 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Endpoint.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Endpoint.cs @@ -44,16 +44,18 @@ public Endpoint() /// Resource name. /// Resource type. /// Resource tags. - /// The host header value sent to the - /// origin with each request. If you leave this blank, the request - /// hostname determines this value. Azure CDN origins, such as Web - /// Apps, Blob Storage, and Cloud Services require this host header - /// value to match the origin hostname by default. /// A directory path on the origin that CDN /// can use to retrieve content from, e.g. /// contoso.cloudapp.net/originpath. /// List of content types on which /// compression applies. The value should be a valid MIME type. + /// The host header value sent to the + /// origin with each request. This property at Endpoint is only allowed + /// when endpoint uses single origin and can be overridden by the same + /// property specified at origin.If you leave this blank, the request + /// hostname determines this value. Azure CDN origins, such as Web + /// Apps, Blob Storage, and Cloud Services require this host header + /// value to match the origin hostname by default. /// Indicates whether content /// compression is enabled on CDN. Default value is false. If /// compression is enabled, content will be served as compressed if @@ -81,26 +83,37 @@ public Endpoint() /// Path to a file hosted on the origin which /// helps accelerate delivery of the dynamic content and calculate the /// most optimal routes for the CDN. This is relative to the origin - /// path. + /// path. This property is only relevant when using a single + /// origin. /// List of rules defining the user's geo /// access within a CDN endpoint. Each geo filter defines an access /// rule to a specified path or content, e.g. block APAC for path /// /pictures/ + /// A reference to the origin + /// group. + /// List of keys used to validate the + /// signed URL hashes. /// A policy that specifies the delivery /// rules to be used for an endpoint. + /// Defines the Web + /// Application Firewall policy for the endpoint (if + /// applicable) /// The host name of the endpoint structured as /// {endpointName}.{DNSZone}, e.g. contoso.azureedge.net + /// The origin groups comprising of origins + /// that are used for load balancing the traffic based on + /// availability. /// Resource status of the endpoint. /// Possible values include: 'Creating', 'Deleting', 'Running', /// 'Starting', 'Stopped', 'Stopping' /// Provisioning status of the /// endpoint. - public Endpoint(string location, IList origins, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string originHostHeader = default(string), string originPath = default(string), IList contentTypesToCompress = default(IList), bool? isCompressionEnabled = default(bool?), bool? isHttpAllowed = default(bool?), bool? isHttpsAllowed = default(bool?), QueryStringCachingBehavior? queryStringCachingBehavior = default(QueryStringCachingBehavior?), string optimizationType = default(string), string probePath = default(string), IList geoFilters = default(IList), EndpointPropertiesUpdateParametersDeliveryPolicy deliveryPolicy = default(EndpointPropertiesUpdateParametersDeliveryPolicy), string hostName = default(string), string resourceState = default(string), string provisioningState = default(string)) + public Endpoint(string location, IList origins, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string originPath = default(string), IList contentTypesToCompress = default(IList), string originHostHeader = default(string), bool? isCompressionEnabled = default(bool?), bool? isHttpAllowed = default(bool?), bool? isHttpsAllowed = default(bool?), QueryStringCachingBehavior? queryStringCachingBehavior = default(QueryStringCachingBehavior?), string optimizationType = default(string), string probePath = default(string), IList geoFilters = default(IList), ResourceReference defaultOriginGroup = default(ResourceReference), IList urlSigningKeys = default(IList), EndpointPropertiesUpdateParametersDeliveryPolicy deliveryPolicy = default(EndpointPropertiesUpdateParametersDeliveryPolicy), EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink webApplicationFirewallPolicyLink = default(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink), string hostName = default(string), IList originGroups = default(IList), string resourceState = default(string), string provisioningState = default(string)) : base(location, id, name, type, tags) { - OriginHostHeader = originHostHeader; OriginPath = originPath; ContentTypesToCompress = contentTypesToCompress; + OriginHostHeader = originHostHeader; IsCompressionEnabled = isCompressionEnabled; IsHttpAllowed = isHttpAllowed; IsHttpsAllowed = isHttpsAllowed; @@ -108,9 +121,13 @@ public Endpoint() OptimizationType = optimizationType; ProbePath = probePath; GeoFilters = geoFilters; + DefaultOriginGroup = defaultOriginGroup; + UrlSigningKeys = urlSigningKeys; DeliveryPolicy = deliveryPolicy; + WebApplicationFirewallPolicyLink = webApplicationFirewallPolicyLink; HostName = hostName; Origins = origins; + OriginGroups = originGroups; ResourceState = resourceState; ProvisioningState = provisioningState; CustomInit(); @@ -121,16 +138,6 @@ public Endpoint() /// partial void CustomInit(); - /// - /// Gets or sets the host header value sent to the origin with each - /// request. If you leave this blank, the request hostname determines - /// this value. Azure CDN origins, such as Web Apps, Blob Storage, and - /// Cloud Services require this host header value to match the origin - /// hostname by default. - /// - [JsonProperty(PropertyName = "properties.originHostHeader")] - public string OriginHostHeader { get; set; } - /// /// Gets or sets a directory path on the origin that CDN can use to /// retrieve content from, e.g. contoso.cloudapp.net/originpath. @@ -145,6 +152,18 @@ public Endpoint() [JsonProperty(PropertyName = "properties.contentTypesToCompress")] public IList ContentTypesToCompress { get; set; } + /// + /// Gets or sets the host header value sent to the origin with each + /// request. This property at Endpoint is only allowed when endpoint + /// uses single origin and can be overridden by the same property + /// specified at origin.If you leave this blank, the request hostname + /// determines this value. Azure CDN origins, such as Web Apps, Blob + /// Storage, and Cloud Services require this host header value to match + /// the origin hostname by default. + /// + [JsonProperty(PropertyName = "properties.originHostHeader")] + public string OriginHostHeader { get; set; } + /// /// Gets or sets indicates whether content compression is enabled on /// CDN. Default value is false. If compression is enabled, content @@ -197,6 +216,7 @@ public Endpoint() /// Gets or sets path to a file hosted on the origin which helps /// accelerate delivery of the dynamic content and calculate the most /// optimal routes for the CDN. This is relative to the origin path. + /// This property is only relevant when using a single origin. /// [JsonProperty(PropertyName = "properties.probePath")] public string ProbePath { get; set; } @@ -209,6 +229,18 @@ public Endpoint() [JsonProperty(PropertyName = "properties.geoFilters")] public IList GeoFilters { get; set; } + /// + /// Gets or sets a reference to the origin group. + /// + [JsonProperty(PropertyName = "properties.defaultOriginGroup")] + public ResourceReference DefaultOriginGroup { get; set; } + + /// + /// Gets or sets list of keys used to validate the signed URL hashes. + /// + [JsonProperty(PropertyName = "properties.urlSigningKeys")] + public IList UrlSigningKeys { get; set; } + /// /// Gets or sets a policy that specifies the delivery rules to be used /// for an endpoint. @@ -216,6 +248,13 @@ public Endpoint() [JsonProperty(PropertyName = "properties.deliveryPolicy")] public EndpointPropertiesUpdateParametersDeliveryPolicy DeliveryPolicy { get; set; } + /// + /// Gets or sets defines the Web Application Firewall policy for the + /// endpoint (if applicable) + /// + [JsonProperty(PropertyName = "properties.webApplicationFirewallPolicyLink")] + public EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink WebApplicationFirewallPolicyLink { get; set; } + /// /// Gets the host name of the endpoint structured as /// {endpointName}.{DNSZone}, e.g. contoso.azureedge.net @@ -229,6 +268,13 @@ public Endpoint() [JsonProperty(PropertyName = "properties.origins")] public IList Origins { get; set; } + /// + /// Gets or sets the origin groups comprising of origins that are used + /// for load balancing the traffic based on availability. + /// + [JsonProperty(PropertyName = "properties.originGroups")] + public IList OriginGroups { get; set; } + /// /// Gets resource status of the endpoint. Possible values include: /// 'Creating', 'Deleting', 'Running', 'Starting', 'Stopped', @@ -266,17 +312,37 @@ public override void Validate() } } } + if (UrlSigningKeys != null) + { + foreach (var element1 in UrlSigningKeys) + { + if (element1 != null) + { + element1.Validate(); + } + } + } if (DeliveryPolicy != null) { DeliveryPolicy.Validate(); } if (Origins != null) { - foreach (var element1 in Origins) + foreach (var element2 in Origins) { - if (element1 != null) + if (element2 != null) { - element1.Validate(); + element2.Validate(); + } + } + } + if (OriginGroups != null) + { + foreach (var element3 in OriginGroups) + { + if (element3 != null) + { + element3.Validate(); } } } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs new file mode 100644 index 000000000000..b44376d4edb0 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the Web Application Firewall policy for the endpoint (if + /// applicable) + /// + public partial class EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + { + /// + /// Initializes a new instance of the + /// EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + /// class. + /// + public EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink + /// class. + /// + /// Resource ID. + public EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink(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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointUpdateParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointUpdateParameters.cs index ebd9890d26ce..ad801c8f03c9 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointUpdateParameters.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/EndpointUpdateParameters.cs @@ -36,16 +36,18 @@ public EndpointUpdateParameters() /// Initializes a new instance of the EndpointUpdateParameters class. /// /// Endpoint tags. - /// The host header value sent to the - /// origin with each request. If you leave this blank, the request - /// hostname determines this value. Azure CDN origins, such as Web - /// Apps, Blob Storage, and Cloud Services require this host header - /// value to match the origin hostname by default. /// A directory path on the origin that CDN /// can use to retrieve content from, e.g. /// contoso.cloudapp.net/originpath. /// List of content types on which /// compression applies. The value should be a valid MIME type. + /// The host header value sent to the + /// origin with each request. This property at Endpoint is only allowed + /// when endpoint uses single origin and can be overridden by the same + /// property specified at origin.If you leave this blank, the request + /// hostname determines this value. Azure CDN origins, such as Web + /// Apps, Blob Storage, and Cloud Services require this host header + /// value to match the origin hostname by default. /// Indicates whether content /// compression is enabled on CDN. Default value is false. If /// compression is enabled, content will be served as compressed if @@ -73,19 +75,27 @@ public EndpointUpdateParameters() /// Path to a file hosted on the origin which /// helps accelerate delivery of the dynamic content and calculate the /// most optimal routes for the CDN. This is relative to the origin - /// path. + /// path. This property is only relevant when using a single + /// origin. /// List of rules defining the user's geo /// access within a CDN endpoint. Each geo filter defines an access /// rule to a specified path or content, e.g. block APAC for path /// /pictures/ + /// A reference to the origin + /// group. + /// List of keys used to validate the + /// signed URL hashes. /// A policy that specifies the delivery /// rules to be used for an endpoint. - public EndpointUpdateParameters(IDictionary tags = default(IDictionary), string originHostHeader = default(string), string originPath = default(string), IList contentTypesToCompress = default(IList), bool? isCompressionEnabled = default(bool?), bool? isHttpAllowed = default(bool?), bool? isHttpsAllowed = default(bool?), QueryStringCachingBehavior? queryStringCachingBehavior = default(QueryStringCachingBehavior?), string optimizationType = default(string), string probePath = default(string), IList geoFilters = default(IList), EndpointPropertiesUpdateParametersDeliveryPolicy deliveryPolicy = default(EndpointPropertiesUpdateParametersDeliveryPolicy)) + /// Defines the Web + /// Application Firewall policy for the endpoint (if + /// applicable) + public EndpointUpdateParameters(IDictionary tags = default(IDictionary), string originPath = default(string), IList contentTypesToCompress = default(IList), string originHostHeader = default(string), bool? isCompressionEnabled = default(bool?), bool? isHttpAllowed = default(bool?), bool? isHttpsAllowed = default(bool?), QueryStringCachingBehavior? queryStringCachingBehavior = default(QueryStringCachingBehavior?), string optimizationType = default(string), string probePath = default(string), IList geoFilters = default(IList), ResourceReference defaultOriginGroup = default(ResourceReference), IList urlSigningKeys = default(IList), EndpointPropertiesUpdateParametersDeliveryPolicy deliveryPolicy = default(EndpointPropertiesUpdateParametersDeliveryPolicy), EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink webApplicationFirewallPolicyLink = default(EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink)) { Tags = tags; - OriginHostHeader = originHostHeader; OriginPath = originPath; ContentTypesToCompress = contentTypesToCompress; + OriginHostHeader = originHostHeader; IsCompressionEnabled = isCompressionEnabled; IsHttpAllowed = isHttpAllowed; IsHttpsAllowed = isHttpsAllowed; @@ -93,7 +103,10 @@ public EndpointUpdateParameters() OptimizationType = optimizationType; ProbePath = probePath; GeoFilters = geoFilters; + DefaultOriginGroup = defaultOriginGroup; + UrlSigningKeys = urlSigningKeys; DeliveryPolicy = deliveryPolicy; + WebApplicationFirewallPolicyLink = webApplicationFirewallPolicyLink; CustomInit(); } @@ -108,16 +121,6 @@ public EndpointUpdateParameters() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } - /// - /// Gets or sets the host header value sent to the origin with each - /// request. If you leave this blank, the request hostname determines - /// this value. Azure CDN origins, such as Web Apps, Blob Storage, and - /// Cloud Services require this host header value to match the origin - /// hostname by default. - /// - [JsonProperty(PropertyName = "properties.originHostHeader")] - public string OriginHostHeader { get; set; } - /// /// Gets or sets a directory path on the origin that CDN can use to /// retrieve content from, e.g. contoso.cloudapp.net/originpath. @@ -132,6 +135,18 @@ public EndpointUpdateParameters() [JsonProperty(PropertyName = "properties.contentTypesToCompress")] public IList ContentTypesToCompress { get; set; } + /// + /// Gets or sets the host header value sent to the origin with each + /// request. This property at Endpoint is only allowed when endpoint + /// uses single origin and can be overridden by the same property + /// specified at origin.If you leave this blank, the request hostname + /// determines this value. Azure CDN origins, such as Web Apps, Blob + /// Storage, and Cloud Services require this host header value to match + /// the origin hostname by default. + /// + [JsonProperty(PropertyName = "properties.originHostHeader")] + public string OriginHostHeader { get; set; } + /// /// Gets or sets indicates whether content compression is enabled on /// CDN. Default value is false. If compression is enabled, content @@ -184,6 +199,7 @@ public EndpointUpdateParameters() /// Gets or sets path to a file hosted on the origin which helps /// accelerate delivery of the dynamic content and calculate the most /// optimal routes for the CDN. This is relative to the origin path. + /// This property is only relevant when using a single origin. /// [JsonProperty(PropertyName = "properties.probePath")] public string ProbePath { get; set; } @@ -196,6 +212,18 @@ public EndpointUpdateParameters() [JsonProperty(PropertyName = "properties.geoFilters")] public IList GeoFilters { get; set; } + /// + /// Gets or sets a reference to the origin group. + /// + [JsonProperty(PropertyName = "properties.defaultOriginGroup")] + public ResourceReference DefaultOriginGroup { get; set; } + + /// + /// Gets or sets list of keys used to validate the signed URL hashes. + /// + [JsonProperty(PropertyName = "properties.urlSigningKeys")] + public IList UrlSigningKeys { get; set; } + /// /// Gets or sets a policy that specifies the delivery rules to be used /// for an endpoint. @@ -203,6 +231,13 @@ public EndpointUpdateParameters() [JsonProperty(PropertyName = "properties.deliveryPolicy")] public EndpointPropertiesUpdateParametersDeliveryPolicy DeliveryPolicy { get; set; } + /// + /// Gets or sets defines the Web Application Firewall policy for the + /// endpoint (if applicable) + /// + [JsonProperty(PropertyName = "properties.webApplicationFirewallPolicyLink")] + public EndpointPropertiesUpdateParametersWebApplicationFirewallPolicyLink WebApplicationFirewallPolicyLink { get; set; } + /// /// Validate the object. /// @@ -221,6 +256,16 @@ public virtual void Validate() } } } + if (UrlSigningKeys != null) + { + foreach (var element1 in UrlSigningKeys) + { + if (element1 != null) + { + element1.Validate(); + } + } + } if (DeliveryPolicy != null) { DeliveryPolicy.Validate(); diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeParameters.cs new file mode 100644 index 000000000000..dc26b978869c --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeParameters.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The JSON object that contains the properties to send health probes to + /// origin. + /// + public partial class HealthProbeParameters + { + /// + /// Initializes a new instance of the HealthProbeParameters class. + /// + public HealthProbeParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HealthProbeParameters class. + /// + /// The path relative to the origin that is + /// used to determine the health of the origin. + /// The type of health probe request + /// that is made. Possible values include: 'NotSet', 'GET', + /// 'HEAD' + /// Protocol to use for health probe. + /// Possible values include: 'NotSet', 'Http', 'Https' + /// The number of seconds between + /// health probes.Default is 240sec. + public HealthProbeParameters(string probePath = default(string), HealthProbeRequestType? probeRequestType = default(HealthProbeRequestType?), ProbeProtocol? probeProtocol = default(ProbeProtocol?), int? probeIntervalInSeconds = default(int?)) + { + ProbePath = probePath; + ProbeRequestType = probeRequestType; + ProbeProtocol = probeProtocol; + ProbeIntervalInSeconds = probeIntervalInSeconds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the path relative to the origin that is used to + /// determine the health of the origin. + /// + [JsonProperty(PropertyName = "probePath")] + public string ProbePath { get; set; } + + /// + /// Gets or sets the type of health probe request that is made. + /// Possible values include: 'NotSet', 'GET', 'HEAD' + /// + [JsonProperty(PropertyName = "probeRequestType")] + public HealthProbeRequestType? ProbeRequestType { get; set; } + + /// + /// Gets or sets protocol to use for health probe. Possible values + /// include: 'NotSet', 'Http', 'Https' + /// + [JsonProperty(PropertyName = "probeProtocol")] + public ProbeProtocol? ProbeProtocol { get; set; } + + /// + /// Gets or sets the number of seconds between health probes.Default is + /// 240sec. + /// + [JsonProperty(PropertyName = "probeIntervalInSeconds")] + public int? ProbeIntervalInSeconds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProbeIntervalInSeconds > 255) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ProbeIntervalInSeconds", 255); + } + if (ProbeIntervalInSeconds < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ProbeIntervalInSeconds", 1); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeRequestType.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeRequestType.cs new file mode 100644 index 000000000000..85d0ade1aa1e --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HealthProbeRequestType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for HealthProbeRequestType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum HealthProbeRequestType + { + [EnumMember(Value = "NotSet")] + NotSet, + [EnumMember(Value = "GET")] + GET, + [EnumMember(Value = "HEAD")] + HEAD + } + internal static class HealthProbeRequestTypeEnumExtension + { + internal static string ToSerializedValue(this HealthProbeRequestType? value) + { + return value == null ? null : ((HealthProbeRequestType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this HealthProbeRequestType value) + { + switch( value ) + { + case HealthProbeRequestType.NotSet: + return "NotSet"; + case HealthProbeRequestType.GET: + return "GET"; + case HealthProbeRequestType.HEAD: + return "HEAD"; + } + return null; + } + + internal static HealthProbeRequestType? ParseHealthProbeRequestType(this string value) + { + switch( value ) + { + case "NotSet": + return HealthProbeRequestType.NotSet; + case "GET": + return HealthProbeRequestType.GET; + case "HEAD": + return HealthProbeRequestType.HEAD; + } + return null; + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HttpErrorRangeParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HttpErrorRangeParameters.cs new file mode 100644 index 000000000000..6bb7ab6ba530 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/HttpErrorRangeParameters.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.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The JSON object that represents the range for http status codes + /// + public partial class HttpErrorRangeParameters + { + /// + /// Initializes a new instance of the HttpErrorRangeParameters class. + /// + public HttpErrorRangeParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpErrorRangeParameters class. + /// + /// The inclusive start of the http status code + /// range. + /// The inclusive end of the http status code + /// range. + public HttpErrorRangeParameters(int? begin = default(int?), int? end = default(int?)) + { + Begin = begin; + End = end; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the inclusive start of the http status code range. + /// + [JsonProperty(PropertyName = "begin")] + public int? Begin { get; set; } + + /// + /// Gets or sets the inclusive end of the http status code range. + /// + [JsonProperty(PropertyName = "end")] + public int? End { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Begin > 999) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Begin", 999); + } + if (Begin < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Begin", 100); + } + if (End > 999) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "End", 999); + } + if (End < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "End", 100); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/KeyVaultSigningKeyParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/KeyVaultSigningKeyParameters.cs new file mode 100644 index 000000000000..30691579ea22 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/KeyVaultSigningKeyParameters.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the parameters for using a user's KeyVault for URL Signing + /// Key. + /// + public partial class KeyVaultSigningKeyParameters + { + /// + /// Initializes a new instance of the KeyVaultSigningKeyParameters + /// class. + /// + public KeyVaultSigningKeyParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultSigningKeyParameters + /// class. + /// + /// Subscription Id of the user's Key + /// Vault containing the secret + /// Resource group of the user's Key + /// Vault containing the secret + /// The name of the user's Key Vault containing + /// the secret + /// The name of secret in Key Vault. + /// The version(GUID) of secret in Key + /// Vault. + public KeyVaultSigningKeyParameters(string subscriptionId, string resourceGroupName, string vaultName, string secretName, string secretVersion) + { + SubscriptionId = subscriptionId; + ResourceGroupName = resourceGroupName; + VaultName = vaultName; + SecretName = secretName; + SecretVersion = secretVersion; + CustomInit(); + } + /// + /// Static constructor for KeyVaultSigningKeyParameters class. + /// + static KeyVaultSigningKeyParameters() + { + Odatatype = "#Microsoft.Azure.Cdn.Models.KeyVaultSigningKeyParameters"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets subscription Id of the user's Key Vault containing the + /// secret + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets resource group of the user's Key Vault containing the + /// secret + /// + [JsonProperty(PropertyName = "resourceGroupName")] + public string ResourceGroupName { get; set; } + + /// + /// Gets or sets the name of the user's Key Vault containing the secret + /// + [JsonProperty(PropertyName = "vaultName")] + public string VaultName { get; set; } + + /// + /// Gets or sets the name of secret in Key Vault. + /// + [JsonProperty(PropertyName = "secretName")] + public string SecretName { get; set; } + + /// + /// Gets or sets the version(GUID) of secret in Key Vault. + /// + [JsonProperty(PropertyName = "secretVersion")] + public string SecretVersion { get; set; } + + /// + /// + [JsonProperty(PropertyName = "@odata.type")] + public static string Odatatype { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubscriptionId"); + } + if (ResourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceGroupName"); + } + if (VaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VaultName"); + } + if (SecretName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SecretName"); + } + if (SecretVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SecretVersion"); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleDefinition.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleDefinition.cs new file mode 100644 index 000000000000..2b5b65628318 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn.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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleEnabledState.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleEnabledState.cs new file mode 100644 index 000000000000..b727c237c94c --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn.Models +{ + + /// + /// Defines values for ManagedRuleEnabledState. + /// + public static class ManagedRuleEnabledState + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupDefinition.cs new file mode 100644 index 000000000000..35544dc88cb7 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn.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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupOverride.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupOverride.cs new file mode 100644 index 000000000000..6160f230c6f4 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleGroupOverride.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.Cdn.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 within + /// the rule set 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 within the rule set + /// 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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleOverride.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleOverride.cs new file mode 100644 index 000000000000..6e843283c916 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn.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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSet.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSet.cs new file mode 100644 index 000000000000..0c4fe4e2a6a0 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSet.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines a managed rule set. + /// + public partial class ManagedRuleSet + { + /// + /// Initializes a new instance of the ManagedRuleSet class. + /// + public ManagedRuleSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleSet class. + /// + /// Defines the rule set type to use. + /// Defines the version of the rule set to + /// use. + /// Verizon only : If the rule set supports + /// anomaly detection mode, this describes the threshold for blocking + /// requests. + /// Defines the rule overrides to + /// apply to the rule set. + public ManagedRuleSet(string ruleSetType, string ruleSetVersion, int? anomalyScore = default(int?), IList ruleGroupOverrides = default(IList)) + { + RuleSetType = ruleSetType; + RuleSetVersion = ruleSetVersion; + AnomalyScore = anomalyScore; + RuleGroupOverrides = ruleGroupOverrides; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the rule set type to use. + /// + [JsonProperty(PropertyName = "ruleSetType")] + public string RuleSetType { get; set; } + + /// + /// Gets or sets defines the version of the rule set to use. + /// + [JsonProperty(PropertyName = "ruleSetVersion")] + public string RuleSetVersion { get; set; } + + /// + /// Gets or sets verizon only : If the rule set supports anomaly + /// detection mode, this describes the threshold for blocking requests. + /// + [JsonProperty(PropertyName = "anomalyScore")] + public int? AnomalyScore { get; set; } + + /// + /// Gets or sets defines the rule 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 (AnomalyScore > 20) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "AnomalyScore", 20); + } + if (AnomalyScore < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "AnomalyScore", 0); + } + if (RuleGroupOverrides != null) + { + foreach (var element in RuleGroupOverrides) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs new file mode 100644 index 000000000000..6e0c89d75391 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetDefinition.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes 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. + /// 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. + /// The pricing tier (defines a CDN provider, feature + /// list and rate) of the CdnWebApplicationFirewallPolicy. + public ManagedRuleSetDefinition(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string ruleSetType = default(string), string ruleSetVersion = default(string), IList ruleGroups = default(IList), Sku sku = default(Sku)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + RuleSetType = ruleSetType; + RuleSetVersion = ruleSetVersion; + RuleGroups = ruleGroups; + Sku = sku; + 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; } + + /// + /// Gets or sets the pricing tier (defines a CDN provider, feature list + /// and rate) of the CdnWebApplicationFirewallPolicy. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetList.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetList.cs new file mode 100644 index 000000000000..a7738658376f --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ManagedRuleSetList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the list of managed rule sets for the policy. + /// + public partial class ManagedRuleSetList + { + /// + /// Initializes a new instance of the ManagedRuleSetList class. + /// + public ManagedRuleSetList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleSetList class. + /// + /// List of rule sets. + public ManagedRuleSetList(IList managedRuleSets = default(IList)) + { + ManagedRuleSets = managedRuleSets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of rule sets. + /// + [JsonProperty(PropertyName = "managedRuleSets")] + public IList ManagedRuleSets { get; set; } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchCondition.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchCondition.cs new file mode 100644 index 000000000000..211e39fad767 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchCondition.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Define match conditions + /// + public partial class MatchCondition + { + /// + /// 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', 'SocketAddr', + /// 'RequestMethod', 'RequestHeader', 'RequestUri', 'QueryString', + /// 'RequestBody', 'Cookies', 'PostArgs' + /// 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 a specific key + /// for QueryString, Cookies, RequestHeader or PostArgs. + /// 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', 'SocketAddr', 'RequestMethod', + /// 'RequestHeader', 'RequestUri', 'QueryString', 'RequestBody', + /// 'Cookies', 'PostArgs' + /// + [JsonProperty(PropertyName = "matchVariable")] + public string MatchVariable { get; set; } + + /// + /// Gets or sets selector can used to match a specific key for + /// QueryString, Cookies, RequestHeader or PostArgs. + /// + [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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchVariable.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchVariable.cs new file mode 100644 index 000000000000..41075c8d9d17 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/MatchVariable.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + + /// + /// Defines values for MatchVariable. + /// + public static class MatchVariable + { + public const string RemoteAddr = "RemoteAddr"; + public const string SocketAddr = "SocketAddr"; + public const string RequestMethod = "RequestMethod"; + public const string RequestHeader = "RequestHeader"; + public const string RequestUri = "RequestUri"; + public const string QueryString = "QueryString"; + public const string RequestBody = "RequestBody"; + public const string Cookies = "Cookies"; + public const string PostArgs = "PostArgs"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OperatorModel.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OperatorModel.cs new file mode 100644 index 000000000000..2d41e739271d --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OperatorModel.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + + /// + /// Defines values for OperatorModel. + /// + public static class OperatorModel + { + public const string Any = "Any"; + public const string IPMatch = "IPMatch"; + public const string GeoMatch = "GeoMatch"; + public const string Equal = "Equal"; + public const string Contains = "Contains"; + public const string LessThan = "LessThan"; + public const string GreaterThan = "GreaterThan"; + public const string LessThanOrEqual = "LessThanOrEqual"; + public const string GreaterThanOrEqual = "GreaterThanOrEqual"; + public const string BeginsWith = "BeginsWith"; + public const string EndsWith = "EndsWith"; + public const string RegEx = "RegEx"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs index 516b7312acc1..e792858bb109 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs @@ -38,28 +38,67 @@ public Origin() /// Initializes a new instance of the Origin class. /// /// Resource location. - /// The address of the origin. Domain names, - /// IPv4 addresses, and IPv6 addresses are supported. /// Resource ID. /// Resource name. /// Resource type. /// Resource tags. + /// The address of the origin. Domain names, + /// IPv4 addresses, and IPv6 addresses are supported.This should be + /// unique across all origins in an endpoint. /// The value of the HTTP port. Must be between /// 1 and 65535. - /// The value of the https port. Must be + /// The value of the HTTPS port. Must be /// between 1 and 65535. + /// The host header value sent to the + /// origin with each request. If you leave this blank, the request + /// hostname determines this value. Azure CDN origins, such as Web + /// Apps, Blob Storage, and Cloud Services require this host header + /// value to match the origin hostname by default. This overrides the + /// host header defined at Endpoint + /// Priority of origin in given origin group for + /// load balancing. Higher priorities will not be used for load + /// balancing if any lower priority origin is healthy.Must be between 1 + /// and 5 + /// Weight of the origin in given origin group for + /// load balancing. Must be between 1 and 1000 + /// Origin is enabled for load balancing or + /// not + /// The Alias of the Private Link + /// resource. Populating this optional field indicates that this origin + /// is 'Private' + /// The Resource Id of the Private + /// Link resource. Populating this optional field indicates that this + /// backend is 'Private' + /// The location of the Private Link + /// resource. Required only if 'privateLinkResourceId' is + /// populated + /// A custom message to be + /// included in the approval request to connect to the Private + /// Link. /// Resource status of the origin. Possible /// values include: 'Creating', 'Active', 'Deleting' /// Provisioning status of the /// origin. - public Origin(string location, string hostName, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), int? httpPort = default(int?), int? httpsPort = default(int?), string resourceState = default(string), string provisioningState = default(string)) + /// The approval status for the + /// connection to the Private Link. Possible values include: 'Pending', + /// 'Approved', 'Rejected', 'Disconnected', 'Timeout' + public Origin(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string), string resourceState = default(string), string provisioningState = default(string), string privateEndpointStatus = default(string)) : base(location, id, name, type, tags) { HostName = hostName; HttpPort = httpPort; HttpsPort = httpsPort; + OriginHostHeader = originHostHeader; + Priority = priority; + Weight = weight; + Enabled = enabled; + PrivateLinkAlias = privateLinkAlias; + PrivateLinkResourceId = privateLinkResourceId; + PrivateLinkLocation = privateLinkLocation; + PrivateLinkApprovalMessage = privateLinkApprovalMessage; ResourceState = resourceState; ProvisioningState = provisioningState; + PrivateEndpointStatus = privateEndpointStatus; CustomInit(); } @@ -70,7 +109,8 @@ public Origin() /// /// Gets or sets the address of the origin. Domain names, IPv4 - /// addresses, and IPv6 addresses are supported. + /// addresses, and IPv6 addresses are supported.This should be unique + /// across all origins in an endpoint. /// [JsonProperty(PropertyName = "properties.hostName")] public string HostName { get; set; } @@ -83,12 +123,73 @@ public Origin() public int? HttpPort { get; set; } /// - /// Gets or sets the value of the https port. Must be between 1 and + /// Gets or sets the value of the HTTPS port. Must be between 1 and /// 65535. /// [JsonProperty(PropertyName = "properties.httpsPort")] public int? HttpsPort { get; set; } + /// + /// Gets or sets the host header value sent to the origin with each + /// request. If you leave this blank, the request hostname determines + /// this value. Azure CDN origins, such as Web Apps, Blob Storage, and + /// Cloud Services require this host header value to match the origin + /// hostname by default. This overrides the host header defined at + /// Endpoint + /// + [JsonProperty(PropertyName = "properties.originHostHeader")] + public string OriginHostHeader { get; set; } + + /// + /// Gets or sets priority of origin in given origin group for load + /// balancing. Higher priorities will not be used for load balancing if + /// any lower priority origin is healthy.Must be between 1 and 5 + /// + [JsonProperty(PropertyName = "properties.priority")] + public int? Priority { get; set; } + + /// + /// Gets or sets weight of the origin in given origin group for load + /// balancing. Must be between 1 and 1000 + /// + [JsonProperty(PropertyName = "properties.weight")] + public int? Weight { get; set; } + + /// + /// Gets or sets origin is enabled for load balancing or not + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the Alias of the Private Link resource. Populating + /// this optional field indicates that this origin is 'Private' + /// + [JsonProperty(PropertyName = "properties.privateLinkAlias")] + public string PrivateLinkAlias { get; set; } + + /// + /// Gets or sets the Resource Id of the Private Link resource. + /// Populating this optional field indicates that this backend is + /// 'Private' + /// + [JsonProperty(PropertyName = "properties.privateLinkResourceId")] + public string PrivateLinkResourceId { get; set; } + + /// + /// Gets or sets the location of the Private Link resource. Required + /// only if 'privateLinkResourceId' is populated + /// + [JsonProperty(PropertyName = "properties.privateLinkLocation")] + public string PrivateLinkLocation { get; set; } + + /// + /// Gets or sets a custom message to be included in the approval + /// request to connect to the Private Link. + /// + [JsonProperty(PropertyName = "properties.privateLinkApprovalMessage")] + public string PrivateLinkApprovalMessage { get; set; } + /// /// Gets resource status of the origin. Possible values include: /// 'Creating', 'Active', 'Deleting' @@ -102,6 +203,14 @@ public Origin() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } + /// + /// Gets the approval status for the connection to the Private Link. + /// Possible values include: 'Pending', 'Approved', 'Rejected', + /// 'Disconnected', 'Timeout' + /// + [JsonProperty(PropertyName = "properties.privateEndpointStatus")] + public string PrivateEndpointStatus { get; private set; } + /// /// Validate the object. /// @@ -111,10 +220,6 @@ public Origin() public override void Validate() { base.Validate(); - if (HostName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "HostName"); - } if (HttpPort > 65535) { throw new ValidationException(ValidationRules.InclusiveMaximum, "HttpPort", 65535); @@ -131,6 +236,22 @@ public override void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "HttpsPort", 1); } + if (Priority > 5) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 5); + } + if (Priority < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 1); + } + if (Weight > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Weight", 1000); + } + if (Weight < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 1); + } } } } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroup.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroup.cs new file mode 100644 index 000000000000..1e1157c9729f --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroup.cs @@ -0,0 +1,146 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Origin group comprising of origins is used for load balancing to + /// origins when the content cannot be served from CDN. + /// + [Rest.Serialization.JsonTransformation] + public partial class OriginGroup : ProxyResource + { + /// + /// Initializes a new instance of the OriginGroup class. + /// + public OriginGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OriginGroup class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Health probe settings to the + /// origin that is used to determine the health of the origin. + /// The source of the content being delivered via + /// CDN within given origin group. + /// Time + /// in minutes to shift the traffic to the endpoint gradually when an + /// unhealthy endpoint comes healthy or a new endpoint is added. + /// Default is 10 mins. This property is currently not + /// supported. + /// The JSON + /// object that contains the properties to determine origin health + /// using real requests/responses. This property is currently not + /// supported. + /// Resource status of the origin group. + /// Possible values include: 'Creating', 'Active', 'Deleting' + /// Provisioning status of the origin + /// group. + public OriginGroup(string id = default(string), string name = default(string), string type = default(string), HealthProbeParameters healthProbeSettings = default(HealthProbeParameters), IList origins = default(IList), int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes = default(int?), ResponseBasedOriginErrorDetectionParameters responseBasedOriginErrorDetectionSettings = default(ResponseBasedOriginErrorDetectionParameters), string resourceState = default(string), string provisioningState = default(string)) + : base(id, name, type) + { + HealthProbeSettings = healthProbeSettings; + Origins = origins; + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes; + ResponseBasedOriginErrorDetectionSettings = responseBasedOriginErrorDetectionSettings; + ResourceState = resourceState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets health probe settings to the origin that is used to + /// determine the health of the origin. + /// + [JsonProperty(PropertyName = "properties.healthProbeSettings")] + public HealthProbeParameters HealthProbeSettings { get; set; } + + /// + /// Gets or sets the source of the content being delivered via CDN + /// within given origin group. + /// + [JsonProperty(PropertyName = "properties.origins")] + public IList Origins { get; set; } + + /// + /// Gets or sets time in minutes to shift the traffic to the endpoint + /// gradually when an unhealthy endpoint comes healthy or a new + /// endpoint is added. Default is 10 mins. This property is currently + /// not supported. + /// + [JsonProperty(PropertyName = "properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes")] + public int? TrafficRestorationTimeToHealedOrNewEndpointsInMinutes { get; set; } + + /// + /// Gets or sets the JSON object that contains the properties to + /// determine origin health using real requests/responses. This + /// property is currently not supported. + /// + [JsonProperty(PropertyName = "properties.responseBasedOriginErrorDetectionSettings")] + public ResponseBasedOriginErrorDetectionParameters ResponseBasedOriginErrorDetectionSettings { get; set; } + + /// + /// Gets resource status of the origin group. Possible values include: + /// 'Creating', 'Active', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.resourceState")] + public string ResourceState { get; private set; } + + /// + /// Gets provisioning status of the origin group. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (HealthProbeSettings != null) + { + HealthProbeSettings.Validate(); + } + if (TrafficRestorationTimeToHealedOrNewEndpointsInMinutes > 50) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", 50); + } + if (TrafficRestorationTimeToHealedOrNewEndpointsInMinutes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", 0); + } + if (ResponseBasedOriginErrorDetectionSettings != null) + { + ResponseBasedOriginErrorDetectionSettings.Validate(); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupResourceState.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupResourceState.cs new file mode 100644 index 000000000000..028955a2514a --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupResourceState.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + + /// + /// Defines values for OriginGroupResourceState. + /// + public static class OriginGroupResourceState + { + public const string Creating = "Creating"; + public const string Active = "Active"; + public const string Deleting = "Deleting"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupUpdateParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupUpdateParameters.cs new file mode 100644 index 000000000000..25cba2a40272 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginGroupUpdateParameters.cs @@ -0,0 +1,125 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Origin group properties needed for origin group creation or update. + /// + [Rest.Serialization.JsonTransformation] + public partial class OriginGroupUpdateParameters : IResource + { + /// + /// Initializes a new instance of the OriginGroupUpdateParameters + /// class. + /// + public OriginGroupUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OriginGroupUpdateParameters + /// class. + /// + /// Health probe settings to the + /// origin that is used to determine the health of the origin. + /// The source of the content being delivered via + /// CDN within given origin group. + /// Time + /// in minutes to shift the traffic to the endpoint gradually when an + /// unhealthy endpoint comes healthy or a new endpoint is added. + /// Default is 10 mins. This property is currently not + /// supported. + /// The JSON + /// object that contains the properties to determine origin health + /// using real requests/responses. This property is currently not + /// supported. + public OriginGroupUpdateParameters(HealthProbeParameters healthProbeSettings = default(HealthProbeParameters), IList origins = default(IList), int? trafficRestorationTimeToHealedOrNewEndpointsInMinutes = default(int?), ResponseBasedOriginErrorDetectionParameters responseBasedOriginErrorDetectionSettings = default(ResponseBasedOriginErrorDetectionParameters)) + { + HealthProbeSettings = healthProbeSettings; + Origins = origins; + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = trafficRestorationTimeToHealedOrNewEndpointsInMinutes; + ResponseBasedOriginErrorDetectionSettings = responseBasedOriginErrorDetectionSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets health probe settings to the origin that is used to + /// determine the health of the origin. + /// + [JsonProperty(PropertyName = "properties.healthProbeSettings")] + public HealthProbeParameters HealthProbeSettings { get; set; } + + /// + /// Gets or sets the source of the content being delivered via CDN + /// within given origin group. + /// + [JsonProperty(PropertyName = "properties.origins")] + public IList Origins { get; set; } + + /// + /// Gets or sets time in minutes to shift the traffic to the endpoint + /// gradually when an unhealthy endpoint comes healthy or a new + /// endpoint is added. Default is 10 mins. This property is currently + /// not supported. + /// + [JsonProperty(PropertyName = "properties.trafficRestorationTimeToHealedOrNewEndpointsInMinutes")] + public int? TrafficRestorationTimeToHealedOrNewEndpointsInMinutes { get; set; } + + /// + /// Gets or sets the JSON object that contains the properties to + /// determine origin health using real requests/responses. This + /// property is currently not supported. + /// + [JsonProperty(PropertyName = "properties.responseBasedOriginErrorDetectionSettings")] + public ResponseBasedOriginErrorDetectionParameters ResponseBasedOriginErrorDetectionSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (HealthProbeSettings != null) + { + HealthProbeSettings.Validate(); + } + if (TrafficRestorationTimeToHealedOrNewEndpointsInMinutes > 50) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", 50); + } + if (TrafficRestorationTimeToHealedOrNewEndpointsInMinutes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TrafficRestorationTimeToHealedOrNewEndpointsInMinutes", 0); + } + if (ResponseBasedOriginErrorDetectionSettings != null) + { + ResponseBasedOriginErrorDetectionSettings.Validate(); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs index eb0b3c45b91b..1c72ae47b29c 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs @@ -14,10 +14,12 @@ namespace Microsoft.Azure.Management.Cdn.Models using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Origin properties needed for origin creation or update. + /// Origin properties needed for origin update. /// [Rest.Serialization.JsonTransformation] public partial class OriginUpdateParameters : IResource @@ -33,17 +35,54 @@ public OriginUpdateParameters() /// /// Initializes a new instance of the OriginUpdateParameters class. /// + /// Origin tags. /// The address of the origin. Domain names, - /// IPv4 addresses, and IPv6 addresses are supported. + /// IPv4 addresses, and IPv6 addresses are supported.This should be + /// unique across all origins in an endpoint. /// The value of the HTTP port. Must be between /// 1 and 65535. /// The value of the HTTPS port. Must be /// between 1 and 65535. - public OriginUpdateParameters(string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?)) + /// The host header value sent to the + /// origin with each request. If you leave this blank, the request + /// hostname determines this value. Azure CDN origins, such as Web + /// Apps, Blob Storage, and Cloud Services require this host header + /// value to match the origin hostname by default. This overrides the + /// host header defined at Endpoint + /// Priority of origin in given origin group for + /// load balancing. Higher priorities will not be used for load + /// balancing if any lower priority origin is healthy.Must be between 1 + /// and 5 + /// Weight of the origin in given origin group for + /// load balancing. Must be between 1 and 1000 + /// Origin is enabled for load balancing or + /// not + /// The Alias of the Private Link + /// resource. Populating this optional field indicates that this origin + /// is 'Private' + /// The Resource Id of the Private + /// Link resource. Populating this optional field indicates that this + /// backend is 'Private' + /// The location of the Private Link + /// resource. Required only if 'privateLinkResourceId' is + /// populated + /// A custom message to be + /// included in the approval request to connect to the Private + /// Link. + public OriginUpdateParameters(IDictionary tags = default(IDictionary), string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string)) { + Tags = tags; HostName = hostName; HttpPort = httpPort; HttpsPort = httpsPort; + OriginHostHeader = originHostHeader; + Priority = priority; + Weight = weight; + Enabled = enabled; + PrivateLinkAlias = privateLinkAlias; + PrivateLinkResourceId = privateLinkResourceId; + PrivateLinkLocation = privateLinkLocation; + PrivateLinkApprovalMessage = privateLinkApprovalMessage; CustomInit(); } @@ -52,9 +91,16 @@ public OriginUpdateParameters() /// partial void CustomInit(); + /// + /// Gets or sets origin tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + /// /// Gets or sets the address of the origin. Domain names, IPv4 - /// addresses, and IPv6 addresses are supported. + /// addresses, and IPv6 addresses are supported.This should be unique + /// across all origins in an endpoint. /// [JsonProperty(PropertyName = "properties.hostName")] public string HostName { get; set; } @@ -73,6 +119,67 @@ public OriginUpdateParameters() [JsonProperty(PropertyName = "properties.httpsPort")] public int? HttpsPort { get; set; } + /// + /// Gets or sets the host header value sent to the origin with each + /// request. If you leave this blank, the request hostname determines + /// this value. Azure CDN origins, such as Web Apps, Blob Storage, and + /// Cloud Services require this host header value to match the origin + /// hostname by default. This overrides the host header defined at + /// Endpoint + /// + [JsonProperty(PropertyName = "properties.originHostHeader")] + public string OriginHostHeader { get; set; } + + /// + /// Gets or sets priority of origin in given origin group for load + /// balancing. Higher priorities will not be used for load balancing if + /// any lower priority origin is healthy.Must be between 1 and 5 + /// + [JsonProperty(PropertyName = "properties.priority")] + public int? Priority { get; set; } + + /// + /// Gets or sets weight of the origin in given origin group for load + /// balancing. Must be between 1 and 1000 + /// + [JsonProperty(PropertyName = "properties.weight")] + public int? Weight { get; set; } + + /// + /// Gets or sets origin is enabled for load balancing or not + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the Alias of the Private Link resource. Populating + /// this optional field indicates that this origin is 'Private' + /// + [JsonProperty(PropertyName = "properties.privateLinkAlias")] + public string PrivateLinkAlias { get; set; } + + /// + /// Gets or sets the Resource Id of the Private Link resource. + /// Populating this optional field indicates that this backend is + /// 'Private' + /// + [JsonProperty(PropertyName = "properties.privateLinkResourceId")] + public string PrivateLinkResourceId { get; set; } + + /// + /// Gets or sets the location of the Private Link resource. Required + /// only if 'privateLinkResourceId' is populated + /// + [JsonProperty(PropertyName = "properties.privateLinkLocation")] + public string PrivateLinkLocation { get; set; } + + /// + /// Gets or sets a custom message to be included in the approval + /// request to connect to the Private Link. + /// + [JsonProperty(PropertyName = "properties.privateLinkApprovalMessage")] + public string PrivateLinkApprovalMessage { get; set; } + /// /// Validate the object. /// @@ -97,6 +204,22 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "HttpsPort", 1); } + if (Priority > 5) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 5); + } + if (Priority < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 1); + } + if (Weight > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Weight", 1000); + } + if (Weight < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 1); + } } } } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ParamIndicator.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ParamIndicator.cs new file mode 100644 index 000000000000..8aa2d242a6ad --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ParamIndicator.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + + /// + /// Defines values for ParamIndicator. + /// + public static class ParamIndicator + { + public const string Expires = "expires"; + public const string KeyId = "keyId"; + public const string Signature = "signature"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyEnabledState.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyEnabledState.cs new file mode 100644 index 000000000000..c1cf0d520502 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyEnabledState.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.Cdn.Models +{ + + /// + /// Defines values for PolicyEnabledState. + /// + public static class PolicyEnabledState + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyMode.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyMode.cs new file mode 100644 index 000000000000..44260954868c --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyMode.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.Cdn.Models +{ + + /// + /// Defines values for PolicyMode. + /// + public static class PolicyMode + { + public const string Prevention = "Prevention"; + public const string Detection = "Detection"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyResourceState.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicyResourceState.cs new file mode 100644 index 000000000000..4ee843e50f7c --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/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.Cdn.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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicySettings.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicySettings.cs new file mode 100644 index 000000000000..93c3e141f6f6 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PolicySettings.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines contents of a web application firewall global configuration + /// + public partial class PolicySettings + { + /// + /// Initializes a new instance of the PolicySettings class. + /// + public PolicySettings() + { + CustomInit(); + } + + /// + /// 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 + /// prevention mode at policy level. Possible values include: + /// 'Prevention', 'Detection' + /// If action type is redirect, this + /// field represents the default redirect URL for the client. + /// If the action + /// type is block, this field defines the default customer overridable + /// http 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 defaultRedirectUrl = default(string), int? defaultCustomBlockResponseStatusCode = default(int?), string defaultCustomBlockResponseBody = default(string)) + { + EnabledState = enabledState; + Mode = mode; + DefaultRedirectUrl = defaultRedirectUrl; + DefaultCustomBlockResponseStatusCode = defaultCustomBlockResponseStatusCode; + DefaultCustomBlockResponseBody = defaultCustomBlockResponseBody; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes if the policy is in enabled state or + /// disabled state. 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 + /// 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 the + /// default redirect URL for the client. + /// + [JsonProperty(PropertyName = "defaultRedirectUrl")] + public string DefaultRedirectUrl { get; set; } + + /// + /// Gets or sets if the action type is block, this field defines the + /// default customer overridable http response status code. + /// + [JsonProperty(PropertyName = "defaultCustomBlockResponseStatusCode")] + public int? DefaultCustomBlockResponseStatusCode { 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 = "defaultCustomBlockResponseBody")] + public string DefaultCustomBlockResponseBody { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DefaultCustomBlockResponseBody != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(DefaultCustomBlockResponseBody, "^(?:[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, "DefaultCustomBlockResponseBody", "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$"); + } + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PrivateEndpointStatus.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PrivateEndpointStatus.cs new file mode 100644 index 000000000000..2f269f887269 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/PrivateEndpointStatus.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + + /// + /// Defines values for PrivateEndpointStatus. + /// + public static class PrivateEndpointStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + public const string Disconnected = "Disconnected"; + public const string Timeout = "Timeout"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProbeProtocol.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProbeProtocol.cs new file mode 100644 index 000000000000..8a630d55334f --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProbeProtocol.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ProbeProtocol. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ProbeProtocol + { + [EnumMember(Value = "NotSet")] + NotSet, + [EnumMember(Value = "Http")] + Http, + [EnumMember(Value = "Https")] + Https + } + internal static class ProbeProtocolEnumExtension + { + internal static string ToSerializedValue(this ProbeProtocol? value) + { + return value == null ? null : ((ProbeProtocol)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ProbeProtocol value) + { + switch( value ) + { + case ProbeProtocol.NotSet: + return "NotSet"; + case ProbeProtocol.Http: + return "Http"; + case ProbeProtocol.Https: + return "Https"; + } + return null; + } + + internal static ProbeProtocol? ParseProbeProtocol(this string value) + { + switch( value ) + { + case "NotSet": + return ProbeProtocol.NotSet; + case "Http": + return ProbeProtocol.Http; + case "Https": + return ProbeProtocol.Https; + } + return null; + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProvisioningState.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..9521ef36ce6c --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Creating = "Creating"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRule.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRule.cs new file mode 100644 index 000000000000..e59b1af80c92 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRule.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines a rate limiting rule that can be included in a waf policy + /// + public partial class RateLimitRule : CustomRule + { + /// + /// Initializes a new instance of the RateLimitRule class. + /// + public RateLimitRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RateLimitRule class. + /// + /// Defines the name of the custom rule + /// Defines in what order this rule be evaluated + /// in the overall list of custom rules + /// List of match conditions. + /// Describes what action to be applied when rule + /// matches. Possible values include: 'Allow', 'Block', 'Log', + /// 'Redirect' + /// Defines rate limit + /// threshold. + /// Defines rate limit + /// duration. Default is 1 minute. + /// Describes if the custom rule is in + /// enabled or disabled state. Defaults to Enabled if not specified. + /// Possible values include: 'Disabled', 'Enabled' + public RateLimitRule(string name, int priority, IList matchConditions, string action, int rateLimitThreshold, int rateLimitDurationInMinutes, string enabledState = default(string)) + : base(name, priority, matchConditions, action, enabledState) + { + RateLimitThreshold = rateLimitThreshold; + RateLimitDurationInMinutes = rateLimitDurationInMinutes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines rate limit threshold. + /// + [JsonProperty(PropertyName = "rateLimitThreshold")] + public int RateLimitThreshold { get; set; } + + /// + /// Gets or sets defines rate limit duration. Default is 1 minute. + /// + [JsonProperty(PropertyName = "rateLimitDurationInMinutes")] + public int RateLimitDurationInMinutes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (RateLimitThreshold < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RateLimitThreshold", 0); + } + if (RateLimitDurationInMinutes > 60) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "RateLimitDurationInMinutes", 60); + } + if (RateLimitDurationInMinutes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RateLimitDurationInMinutes", 0); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRuleList.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRuleList.cs new file mode 100644 index 000000000000..a2a85ba8ebe4 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/RateLimitRuleList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines contents of rate limit rules + /// + public partial class RateLimitRuleList + { + /// + /// Initializes a new instance of the RateLimitRuleList class. + /// + public RateLimitRuleList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RateLimitRuleList class. + /// + /// List of rules + public RateLimitRuleList(IList rules = default(IList)) + { + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of rules + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResourceReference.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResourceReference.cs new file mode 100644 index 000000000000..00b87c3a82a7 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResourceReference.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reference to another resource. + /// + public partial class ResourceReference : IResource + { + /// + /// Initializes a new instance of the ResourceReference class. + /// + public ResourceReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceReference class. + /// + /// Resource ID. + public ResourceReference(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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedDetectedErrorTypes.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedDetectedErrorTypes.cs new file mode 100644 index 000000000000..ad70c77968ad --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedDetectedErrorTypes.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResponseBasedDetectedErrorTypes. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResponseBasedDetectedErrorTypes + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "TcpErrorsOnly")] + TcpErrorsOnly, + [EnumMember(Value = "TcpAndHttpErrors")] + TcpAndHttpErrors + } + internal static class ResponseBasedDetectedErrorTypesEnumExtension + { + internal static string ToSerializedValue(this ResponseBasedDetectedErrorTypes? value) + { + return value == null ? null : ((ResponseBasedDetectedErrorTypes)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResponseBasedDetectedErrorTypes value) + { + switch( value ) + { + case ResponseBasedDetectedErrorTypes.None: + return "None"; + case ResponseBasedDetectedErrorTypes.TcpErrorsOnly: + return "TcpErrorsOnly"; + case ResponseBasedDetectedErrorTypes.TcpAndHttpErrors: + return "TcpAndHttpErrors"; + } + return null; + } + + internal static ResponseBasedDetectedErrorTypes? ParseResponseBasedDetectedErrorTypes(this string value) + { + switch( value ) + { + case "None": + return ResponseBasedDetectedErrorTypes.None; + case "TcpErrorsOnly": + return ResponseBasedDetectedErrorTypes.TcpErrorsOnly; + case "TcpAndHttpErrors": + return ResponseBasedDetectedErrorTypes.TcpAndHttpErrors; + } + return null; + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionParameters.cs new file mode 100644 index 000000000000..e558444d8ee3 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/ResponseBasedOriginErrorDetectionParameters.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The JSON object that contains the properties to determine origin health + /// using real requests/responses. + /// + public partial class ResponseBasedOriginErrorDetectionParameters + { + /// + /// Initializes a new instance of the + /// ResponseBasedOriginErrorDetectionParameters class. + /// + public ResponseBasedOriginErrorDetectionParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResponseBasedOriginErrorDetectionParameters class. + /// + /// Type of response + /// errors for real user requests for which origin will be deemed + /// unhealthy. Possible values include: 'None', 'TcpErrorsOnly', + /// 'TcpAndHttpErrors' + /// The + /// percentage of failed requests in the sample where failover should + /// trigger. + /// The list of Http status code ranges + /// that are considered as server errors for origin and it is marked as + /// unhealthy. + public ResponseBasedOriginErrorDetectionParameters(ResponseBasedDetectedErrorTypes? responseBasedDetectedErrorTypes = default(ResponseBasedDetectedErrorTypes?), int? responseBasedFailoverThresholdPercentage = default(int?), IList httpErrorRanges = default(IList)) + { + ResponseBasedDetectedErrorTypes = responseBasedDetectedErrorTypes; + ResponseBasedFailoverThresholdPercentage = responseBasedFailoverThresholdPercentage; + HttpErrorRanges = httpErrorRanges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of response errors for real user requests for + /// which origin will be deemed unhealthy. Possible values include: + /// 'None', 'TcpErrorsOnly', 'TcpAndHttpErrors' + /// + [JsonProperty(PropertyName = "responseBasedDetectedErrorTypes")] + public ResponseBasedDetectedErrorTypes? ResponseBasedDetectedErrorTypes { get; set; } + + /// + /// Gets or sets the percentage of failed requests in the sample where + /// failover should trigger. + /// + [JsonProperty(PropertyName = "responseBasedFailoverThresholdPercentage")] + public int? ResponseBasedFailoverThresholdPercentage { get; set; } + + /// + /// Gets or sets the list of Http status code ranges that are + /// considered as server errors for origin and it is marked as + /// unhealthy. + /// + [JsonProperty(PropertyName = "httpErrorRanges")] + public IList HttpErrorRanges { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResponseBasedFailoverThresholdPercentage > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ResponseBasedFailoverThresholdPercentage", 100); + } + if (ResponseBasedFailoverThresholdPercentage < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ResponseBasedFailoverThresholdPercentage", 0); + } + if (HttpErrorRanges != null) + { + foreach (var element in HttpErrorRanges) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/TransformType.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/TransformType.cs new file mode 100644 index 000000000000..a744473feefa --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/TransformType.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.Cdn.Models +{ + + /// + /// Defines values for TransformType. + /// + public static class TransformType + { + public const string Lowercase = "Lowercase"; + public const string Uppercase = "Uppercase"; + public const string Trim = "Trim"; + public const string UrlDecode = "UrlDecode"; + public const string UrlEncode = "UrlEncode"; + public const string RemoveNulls = "RemoveNulls"; + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRewriteActionParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRewriteActionParameters.cs index 184fa6b5144d..6a37beac1862 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRewriteActionParameters.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlRewriteActionParameters.cs @@ -31,15 +31,12 @@ public UrlRewriteActionParameters() /// Initializes a new instance of the UrlRewriteActionParameters class. /// /// define a request URI pattern that - /// identifies the type of requests that may be rewritten. Currently, - /// source pattern uses a prefix-based match. To match all URL paths, - /// use "/" as the source pattern value. To match only the root - /// directory and re-write this path, use the origin path field - /// Define the destination path for be used - /// in the rewrite. This will overwrite the source pattern - /// If True, the remaining path - /// after the source pattern will be appended to the new destination - /// path. + /// identifies the type of requests that may be rewritten. If value is + /// blank, all strings are matched. + /// Define the relative URL to which the + /// above requests will be rewritten by. + /// Whether to preserve unmatched + /// path. Default value is true. public UrlRewriteActionParameters(string sourcePattern, string destination, bool? preserveUnmatchedPath = default(bool?)) { SourcePattern = sourcePattern; @@ -62,24 +59,22 @@ static UrlRewriteActionParameters() /// /// Gets or sets define a request URI pattern that identifies the type - /// of requests that may be rewritten. Currently, source pattern uses a - /// prefix-based match. To match all URL paths, use "/" as the source - /// pattern value. To match only the root directory and re-write this - /// path, use the origin path field + /// of requests that may be rewritten. If value is blank, all strings + /// are matched. /// [JsonProperty(PropertyName = "sourcePattern")] public string SourcePattern { get; set; } /// - /// Gets or sets define the destination path for be used in the - /// rewrite. This will overwrite the source pattern + /// Gets or sets define the relative URL to which the above requests + /// will be rewritten by. /// [JsonProperty(PropertyName = "destination")] public string Destination { get; set; } /// - /// Gets or sets if True, the remaining path after the source pattern - /// will be appended to the new destination path. + /// Gets or sets whether to preserve unmatched path. Default value is + /// true. /// [JsonProperty(PropertyName = "preserveUnmatchedPath")] public bool? PreserveUnmatchedPath { get; set; } diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningActionParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningActionParameters.cs new file mode 100644 index 000000000000..d6c227f06a30 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningActionParameters.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the parameters for the Url Signing action. + /// + public partial class UrlSigningActionParameters + { + /// + /// Initializes a new instance of the UrlSigningActionParameters class. + /// + public UrlSigningActionParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UrlSigningActionParameters class. + /// + /// Id reference of the key to be used to verify + /// the hash and should be defined in UrlSigningKeys + /// Possible values include: + /// '#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlSigningActionParameters' + /// Algorithm to use for URL signing. Possible + /// values include: 'SHA256' + /// Defines which query string + /// parameters in the url to be considered for expires, key id etc. + /// + /// Match values to match against. Supports + /// CIDR ranges (both IPv4 and IPv6). + public UrlSigningActionParameters(string keyId, string odatatype = default(string), string algorithm = default(string), IList parameterNameOverride = default(IList), IList ipSubnets = default(IList)) + { + Odatatype = odatatype; + KeyId = keyId; + Algorithm = algorithm; + ParameterNameOverride = parameterNameOverride; + IpSubnets = ipSubnets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: + /// '#Microsoft.Azure.Cdn.Models.DeliveryRuleUrlSigningActionParameters' + /// + [JsonProperty(PropertyName = "@odata.type")] + public string Odatatype { get; set; } + + /// + /// Gets or sets id reference of the key to be used to verify the hash + /// and should be defined in UrlSigningKeys + /// + [JsonProperty(PropertyName = "keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets algorithm to use for URL signing. Possible values + /// include: 'SHA256' + /// + [JsonProperty(PropertyName = "algorithm")] + public string Algorithm { get; set; } + + /// + /// Gets or sets defines which query string parameters in the url to be + /// considered for expires, key id etc. + /// + [JsonProperty(PropertyName = "parameterNameOverride")] + public IList ParameterNameOverride { get; set; } + + /// + /// Gets or sets match values to match against. Supports CIDR ranges + /// (both IPv4 and IPv6). + /// + [JsonProperty(PropertyName = "ipSubnets")] + public IList IpSubnets { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyId"); + } + if (ParameterNameOverride != null) + { + foreach (var element in ParameterNameOverride) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningKey.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningKey.cs new file mode 100644 index 000000000000..22d65143fa42 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningKey.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.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Url signing key + /// + public partial class UrlSigningKey + { + /// + /// Initializes a new instance of the UrlSigningKey class. + /// + public UrlSigningKey() + { + KeySourceParameters = new KeyVaultSigningKeyParameters(); + CustomInit(); + } + + /// + /// Initializes a new instance of the UrlSigningKey class. + /// + /// Defines the customer defined key Id. This id + /// will exist in the incoming request to indicate the key used to form + /// the hash. + /// Defines the parameters for using + /// customer key vault for Url Signing Key. + public UrlSigningKey(string keyId, KeyVaultSigningKeyParameters keySourceParameters) + { + KeyId = keyId; + KeySourceParameters = keySourceParameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the customer defined key Id. This id will + /// exist in the incoming request to indicate the key used to form the + /// hash. + /// + [JsonProperty(PropertyName = "keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets defines the parameters for using customer key vault + /// for Url Signing Key. + /// + [JsonProperty(PropertyName = "keySourceParameters")] + public KeyVaultSigningKeyParameters KeySourceParameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyId"); + } + if (KeySourceParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeySourceParameters"); + } + if (KeySourceParameters != null) + { + KeySourceParameters.Validate(); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningParamIdentifier.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningParamIdentifier.cs new file mode 100644 index 000000000000..634128af578b --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/UrlSigningParamIdentifier.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Cdn.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines how to identify a parameter for a specific purpose e.g. expires + /// + public partial class UrlSigningParamIdentifier + { + /// + /// Initializes a new instance of the UrlSigningParamIdentifier class. + /// + public UrlSigningParamIdentifier() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UrlSigningParamIdentifier class. + /// + /// Indicates the purpose of the + /// parameter. Possible values include: 'expires', 'keyId', + /// 'signature' + /// Parameter name + public UrlSigningParamIdentifier(string paramIndicator, string paramName) + { + ParamIndicator = paramIndicator; + ParamName = paramName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates the purpose of the parameter. Possible + /// values include: 'expires', 'keyId', 'signature' + /// + [JsonProperty(PropertyName = "paramIndicator")] + public string ParamIndicator { get; set; } + + /// + /// Gets or sets parameter name + /// + [JsonProperty(PropertyName = "paramName")] + public string ParamName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ParamIndicator == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ParamIndicator"); + } + if (ParamName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ParamName"); + } + } + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperations.cs new file mode 100644 index 000000000000..a90589ce9e4b --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperations.cs @@ -0,0 +1,1488 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + 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; + + /// + /// OriginGroupsOperations operations. + /// + internal partial class OriginGroupsOperations : IServiceOperations, IOriginGroupsOperations + { + /// + /// Initializes a new instance of the OriginGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OriginGroupsOperations(CdnManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CdnManagementClient + /// + public CdnManagementClient Client { get; private set; } + + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// 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>> ListByEndpointWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByEndpoint", 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Gets an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (originGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("originGroupName", originGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{originGroupName}", System.Uri.EscapeDataString(originGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroup, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (originGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originGroupName"); + } + if (originGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originGroup"); + } + if (originGroup != null) + { + originGroup.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("originGroupName", originGroupName); + tracingParameters.Add("originGroup", originGroup); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{originGroupName}", System.Uri.EscapeDataString(originGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(originGroup != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(originGroup, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // 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); + } + return _result; + } + + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (originGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originGroupName"); + } + if (originGroupUpdateProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originGroupUpdateProperties"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("originGroupName", originGroupName); + tracingParameters.Add("originGroupUpdateProperties", originGroupUpdateProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{originGroupName}", System.Uri.EscapeDataString(originGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(originGroupUpdateProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(originGroupUpdateProperties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new 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); + } + } + // 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); + } + return _result; + } + + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (originGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("originGroupName", originGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{originGroupName}", System.Uri.EscapeDataString(originGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// 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>> ListByEndpointNextWithHttpMessagesAsync(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, "ListByEndpointNext", 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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperationsExtensions.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperationsExtensions.cs new file mode 100644 index 000000000000..33734a249953 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginGroupsOperationsExtensions.cs @@ -0,0 +1,487 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OriginGroupsOperations. + /// + public static partial class OriginGroupsOperationsExtensions + { + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + public static IPage ListByEndpoint(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName) + { + return operations.ListByEndpointAsync(resourceGroupName, profileName, endpointName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByEndpointAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByEndpointWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + public static OriginGroup Get(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName) + { + return operations.GetAsync(resourceGroupName, profileName, endpointName, originGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + public static OriginGroup Create(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup) + { + return operations.CreateAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroup).GetAwaiter().GetResult(); + } + + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + public static OriginGroup Update(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties) + { + return operations.UpdateAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + public static void Delete(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName) + { + operations.DeleteAsync(resourceGroupName, profileName, endpointName, originGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + public static OriginGroup BeginCreate(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup) + { + return operations.BeginCreateAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroup).GetAwaiter().GetResult(); + } + + /// + /// Creates a new origin group within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroup originGroup, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroup, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + public static OriginGroup BeginUpdate(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties) + { + return operations.BeginUpdateAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// Origin group properties + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, OriginGroupUpdateParameters originGroupUpdateProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, originGroupUpdateProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + public static void BeginDelete(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName) + { + operations.BeginDeleteAsync(resourceGroupName, profileName, endpointName, originGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing origin group within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin group which is unique within the endpoint. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IOriginGroupsOperations operations, string resourceGroupName, string profileName, string endpointName, string originGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByEndpointNext(this IOriginGroupsOperations operations, string nextPageLink) + { + return operations.ListByEndpointNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the existing origin groups within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByEndpointNextAsync(this IOriginGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByEndpointNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperations.cs index 462dc7ad8bdc..72894a3d4815 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperations.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperations.cs @@ -489,6 +489,37 @@ internal OriginsOperations(CdnManagementClient client) return _result; } + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Origin origin, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originName, origin, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Updates an existing origin within an endpoint. /// @@ -520,6 +551,312 @@ internal OriginsOperations(CdnManagementClient client) return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Origin origin, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (originName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originName"); + } + if (origin == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "origin"); + } + if (origin != null) + { + origin.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("originName", originName); + tracingParameters.Add("origin", origin); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{originName}", System.Uri.EscapeDataString(originName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(origin != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(origin, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // 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); + } + return _result; + } + /// /// Updates an existing origin within an endpoint. /// @@ -776,6 +1113,209 @@ internal OriginsOperations(CdnManagementClient client) return _result; } + /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string profileName, string endpointName, string originName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (originName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "originName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("originName", originName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{originName}", System.Uri.EscapeDataString(originName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists all of the existing origins within an endpoint. /// diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperationsExtensions.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperationsExtensions.cs index a4c738c03155..9a8151a8b145 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperationsExtensions.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/OriginsOperationsExtensions.cs @@ -119,6 +119,64 @@ public static Origin Get(this IOriginsOperations operations, string resourceGrou } } + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + public static Origin Create(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName, Origin origin) + { + return operations.CreateAsync(resourceGroupName, profileName, endpointName, originName, origin).GetAwaiter().GetResult(); + } + + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName, Origin origin, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originName, origin, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Updates an existing origin within an endpoint. /// @@ -177,6 +235,113 @@ public static Origin Update(this IOriginsOperations operations, string resourceG } } + /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + public static void Delete(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName) + { + operations.DeleteAsync(resourceGroupName, profileName, endpointName, originName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + public static Origin BeginCreate(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName, Origin origin) + { + return operations.BeginCreateAsync(resourceGroupName, profileName, endpointName, originName, origin).GetAwaiter().GetResult(); + } + + /// + /// Creates a new origin within the specified endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin that is unique within the endpoint. + /// + /// + /// Origin properties + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName, Origin origin, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originName, origin, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Updates an existing origin within an endpoint. /// @@ -235,6 +400,55 @@ public static Origin BeginUpdate(this IOriginsOperations operations, string reso } } + /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + public static void BeginDelete(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName) + { + operations.BeginDeleteAsync(resourceGroupName, profileName, endpointName, originName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing origin within an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Name of the CDN profile which is unique within the resource group. + /// + /// + /// Name of the endpoint under the profile which is unique globally. + /// + /// + /// Name of the origin which is unique within the endpoint. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IOriginsOperations operations, string resourceGroupName, string profileName, string endpointName, string originName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, profileName, endpointName, originName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Lists all of the existing origins within an endpoint. /// diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperations.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperations.cs new file mode 100644 index 000000000000..1c9e6902f3b4 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperations.cs @@ -0,0 +1,1396 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + 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; + + /// + /// PoliciesOperations operations. + /// + internal partial class PoliciesOperations : IServiceOperations, IPoliciesOperations + { + /// + /// Initializes a new instance of the PoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PoliciesOperations(CdnManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CdnManagementClient + /// + public CdnManagementClient Client { get; private set; } + + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}").ToString(); + _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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Create or update policy with specified rule set name within a resource + /// group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Policy to be created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, cdnWebApplicationFirewallPolicy, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the specified + /// policy name under the specified subscription and resource group + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, policyName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes Policy + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}").ToString(); + _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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update policy with specified rule set name within a resource + /// group. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Policy to be created. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (cdnWebApplicationFirewallPolicy == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cdnWebApplicationFirewallPolicy"); + } + if (cdnWebApplicationFirewallPolicy != null) + { + cdnWebApplicationFirewallPolicy.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); + tracingParameters.Add("cdnWebApplicationFirewallPolicy", cdnWebApplicationFirewallPolicy); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/CdnWebApplicationFirewallPolicies/{policyName}").ToString(); + _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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(cdnWebApplicationFirewallPolicy != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(cdnWebApplicationFirewallPolicy, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // 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); + } + return _result; + } + + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the specified + /// policy name under the specified subscription and resource group + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + CdnWebApplicationFirewallPolicyPatchParameters cdnWebApplicationFirewallPolicyPatchParameters = new CdnWebApplicationFirewallPolicyPatchParameters(); + if (tags != null) + { + cdnWebApplicationFirewallPolicyPatchParameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); + tracingParameters.Add("cdnWebApplicationFirewallPolicyPatchParameters", cdnWebApplicationFirewallPolicyPatchParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.Cdn/CdnWebApplicationFirewallPolicies/{policyName}").ToString(); + _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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(cdnWebApplicationFirewallPolicyPatchParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(cdnWebApplicationFirewallPolicyPatchParameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new 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); + } + } + // 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); + } + return _result; + } + + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperationsExtensions.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..8975dd872ba9 --- /dev/null +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/PoliciesOperationsExtensions.cs @@ -0,0 +1,364 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.Cdn +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PoliciesOperations. + /// + public static partial class PoliciesOperationsExtensions + { + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + public static IPage List(this IPoliciesOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + public static CdnWebApplicationFirewallPolicy Get(this IPoliciesOperations operations, string resourceGroupName, string policyName) + { + return operations.GetAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update policy with specified rule set name within a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Policy to be created. + /// + public static CdnWebApplicationFirewallPolicy CreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy) + { + return operations.CreateOrUpdateAsync(resourceGroupName, policyName, cdnWebApplicationFirewallPolicy).GetAwaiter().GetResult(); + } + + /// + /// Create or update policy with specified rule set name within a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Policy to be created. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, cdnWebApplicationFirewallPolicy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the specified + /// policy name under the specified subscription and resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + public static CdnWebApplicationFirewallPolicy Update(this IPoliciesOperations operations, string resourceGroupName, string policyName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, policyName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the specified + /// policy name under the specified subscription and resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, policyName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes Policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + public static void Delete(this IPoliciesOperations operations, string resourceGroupName, string policyName) + { + operations.DeleteAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); + } + + /// + /// Deletes Policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update policy with specified rule set name within a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Policy to be created. + /// + public static CdnWebApplicationFirewallPolicy BeginCreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, policyName, cdnWebApplicationFirewallPolicy).GetAwaiter().GetResult(); + } + + /// + /// Create or update policy with specified rule set name within a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// Policy to be created. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CdnWebApplicationFirewallPolicy cdnWebApplicationFirewallPolicy, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, cdnWebApplicationFirewallPolicy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the specified + /// policy name under the specified subscription and resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + public static CdnWebApplicationFirewallPolicy BeginUpdate(this IPoliciesOperations operations, string resourceGroupName, string policyName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, policyName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update an existing CdnWebApplicationFirewallPolicy with the specified + /// policy name under the specified subscription and resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// + /// + /// CdnWebApplicationFirewallPolicy tags + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, policyName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPoliciesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the protection policies within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/SdkInfo_CdnManagementClient.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/SdkInfo_CdnManagementClient.cs index fb13a771d0bf..220bec087543 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/SdkInfo_CdnManagementClient.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/SdkInfo_CdnManagementClient.cs @@ -19,29 +19,21 @@ public static IEnumerable> ApiInfo_CdnManagementCl { return new Tuple[] { - new Tuple("Cdn", "CheckNameAvailability", "2019-04-15"), - new Tuple("Cdn", "CheckNameAvailabilityWithSubscription", "2019-04-15"), - new Tuple("Cdn", "CustomDomains", "2019-04-15"), - new Tuple("Cdn", "EdgeNodes", "2019-04-15"), - new Tuple("Cdn", "Endpoints", "2019-04-15"), - new Tuple("Cdn", "Operations", "2019-04-15"), - new Tuple("Cdn", "Origins", "2019-04-15"), - new Tuple("Cdn", "Profiles", "2019-04-15"), - new Tuple("Cdn", "ResourceUsage", "2019-04-15"), - new Tuple("Cdn", "ValidateProbe", "2019-04-15"), + new Tuple("Cdn", "CheckNameAvailability", "2020-04-15"), + new Tuple("Cdn", "CheckNameAvailabilityWithSubscription", "2020-04-15"), + new Tuple("Cdn", "CustomDomains", "2020-04-15"), + new Tuple("Cdn", "EdgeNodes", "2020-04-15"), + new Tuple("Cdn", "Endpoints", "2020-04-15"), + new Tuple("Cdn", "ManagedRuleSets", "2020-04-15"), + new Tuple("Cdn", "Operations", "2020-04-15"), + new Tuple("Cdn", "OriginGroups", "2020-04-15"), + new Tuple("Cdn", "Origins", "2020-04-15"), + new Tuple("Cdn", "Policies", "2020-04-15"), + new Tuple("Cdn", "Profiles", "2020-04-15"), + new Tuple("Cdn", "ResourceUsage", "2020-04-15"), + new Tuple("Cdn", "ValidateProbe", "2020-04-15"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4407"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cdn/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --tag=package-2019-04 --csharp-sdks-folder=C:\\git\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "5e95a31678db88b8405e189df4aad8f9e9a24c45"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 263c5e3a36db9026a83cc095b57be470d1e9e07b Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 14 Jul 2020 19:37:01 +0000 Subject: [PATCH 2/2] Generated from 0b0aca5ae498fa2dda6e5769fc3223ef3b824772 Make origin a proxyresource for all API versions starting from 12-30-2019 --- .../src/Generated/Models/Origin.cs | 13 ++++--------- .../src/Generated/Models/OriginUpdateParameters.cs | 12 +----------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs index e792858bb109..c44cc9324916 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/Origin.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Cdn.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.Cdn.Models /// configured origins. /// [Rest.Serialization.JsonTransformation] - public partial class Origin : TrackedResource + public partial class Origin : ProxyResource { /// /// Initializes a new instance of the Origin class. @@ -37,11 +35,9 @@ public Origin() /// /// Initializes a new instance of the Origin class. /// - /// Resource location. /// Resource ID. /// Resource name. /// Resource type. - /// Resource tags. /// The address of the origin. Domain names, /// IPv4 addresses, and IPv6 addresses are supported.This should be /// unique across all origins in an endpoint. @@ -82,8 +78,8 @@ public Origin() /// The approval status for the /// connection to the Private Link. Possible values include: 'Pending', /// 'Approved', 'Rejected', 'Disconnected', 'Timeout' - public Origin(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string), string resourceState = default(string), string provisioningState = default(string), string privateEndpointStatus = default(string)) - : base(location, id, name, type, tags) + public Origin(string id = default(string), string name = default(string), string type = default(string), string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string), string resourceState = default(string), string provisioningState = default(string), string privateEndpointStatus = default(string)) + : base(id, name, type) { HostName = hostName; HttpPort = httpPort; @@ -217,9 +213,8 @@ public Origin() /// /// Thrown if validation fails /// - public override void Validate() + public virtual void Validate() { - base.Validate(); if (HttpPort > 65535) { throw new ValidationException(ValidationRules.InclusiveMaximum, "HttpPort", 65535); diff --git a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs index 1c72ae47b29c..8f2efdf302d6 100644 --- a/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs +++ b/sdk/cdn/Microsoft.Azure.Management.Cdn/src/Generated/Models/OriginUpdateParameters.cs @@ -14,8 +14,6 @@ namespace Microsoft.Azure.Management.Cdn.Models using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -35,7 +33,6 @@ public OriginUpdateParameters() /// /// Initializes a new instance of the OriginUpdateParameters class. /// - /// Origin tags. /// The address of the origin. Domain names, /// IPv4 addresses, and IPv6 addresses are supported.This should be /// unique across all origins in an endpoint. @@ -69,9 +66,8 @@ public OriginUpdateParameters() /// A custom message to be /// included in the approval request to connect to the Private /// Link. - public OriginUpdateParameters(IDictionary tags = default(IDictionary), string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string)) + public OriginUpdateParameters(string hostName = default(string), int? httpPort = default(int?), int? httpsPort = default(int?), string originHostHeader = default(string), int? priority = default(int?), int? weight = default(int?), bool? enabled = default(bool?), string privateLinkAlias = default(string), string privateLinkResourceId = default(string), string privateLinkLocation = default(string), string privateLinkApprovalMessage = default(string)) { - Tags = tags; HostName = hostName; HttpPort = httpPort; HttpsPort = httpsPort; @@ -91,12 +87,6 @@ public OriginUpdateParameters() /// partial void CustomInit(); - /// - /// Gets or sets origin tags. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - /// /// Gets or sets the address of the origin. Domain names, IPv4 /// addresses, and IPv6 addresses are supported.This should be unique