From 41879cad240174b577606a40dd3d1d76bd0bd66c Mon Sep 17 00:00:00 2001 From: Phoenix He Date: Mon, 30 Sep 2019 13:32:10 +0800 Subject: [PATCH 1/5] Update swagger_to_sdk_config.json --- swagger_to_sdk_config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index 6e3cd9ab75a3..99979bf5d095 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -10,7 +10,7 @@ }, "advanced_options": { "create_sdk_pull_requests": true, - "sdk_generation_pull_request_base": "main_branch", + "sdk_generation_pull_request_base": "integration_branch", "main_branch": "master" }, "version": "0.2.0" From 51f7a8ffbdb6856fd0cc66398e406d08e336540a Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2019 00:48:30 +0000 Subject: [PATCH 2/5] [AutoPR Microsoft.Azure.Management.ContainerService] Aro 2019-09-30 preview API Version (#200) * Update swagger_to_sdk_config.json * Generated from aa9913e0d2ece26504f653d3b30d22a4a35a0b38 fixing typo and indentation --- .../src/Generated/AgentPoolsOperations.cs | 456 +++++++++++++++++- .../AgentPoolsOperationsExtensions.cs | 100 ++++ .../Generated/ContainerServicesOperations.cs | 2 +- .../src/Generated/IAgentPoolsOperations.cs | 60 +++ .../Generated/ManagedClustersOperations.cs | 24 +- .../src/Generated/Models/AgentPool.cs | 45 +- .../Models/AgentPoolAvailableVersions.cs | 83 ++++ ...VersionsPropertiesAgentPoolVersionsItem.cs | 70 +++ .../Models/AgentPoolUpgradeProfile.cs | 120 +++++ ...oolUpgradeProfilePropertiesUpgradesItem.cs | 60 +++ .../Models/ContainerServiceNetworkProfile.cs | 15 +- .../src/Generated/Models/ManagedCluster.cs | 15 +- .../ManagedClusterAPIServerAccessProfile.cs | 66 +++ .../Models/ManagedClusterAgentPoolProfile.cs | 14 +- ...anagedClusterAgentPoolProfileProperties.cs | 45 +- .../ManagedClusterLoadBalancerProfile.cs | 100 ++++ ...erLoadBalancerProfileManagedOutboundIPs.cs | 75 +++ ...erLoadBalancerProfileOutboundIPPrefixes.cs | 56 +++ ...edClusterLoadBalancerProfileOutboundIPs.cs | 55 +++ .../src/Generated/Models/ResourceReference.cs | 51 ++ .../Models/ScaleSetEvictionPolicy.cs | 22 + .../src/Generated/Models/ScaleSetPriority.cs | 22 + .../src/Generated/Operations.cs | 2 +- .../SdkInfo_ContainerServiceClient.cs | 8 +- 24 files changed, 1531 insertions(+), 35 deletions(-) create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs index 50bf7e4b6b92..63687ae3488d 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs @@ -120,7 +120,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -346,7 +346,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -557,6 +557,454 @@ internal AgentPoolsOperations(ContainerServiceClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetUpgradeProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (agentPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); + } + string apiVersion = "2019-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("agentPoolName", agentPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUpgradeProfile", 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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{agentPoolName}", System.Uri.EscapeDataString(agentPoolName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + string apiVersion = "2019-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAvailableAgentPoolVersions", 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.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Creates or updates an agent pool. /// @@ -644,7 +1092,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -894,7 +1342,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs index 333bc9802a1a..fac6394a3939 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs @@ -228,6 +228,106 @@ public static void Delete(this IAgentPoolsOperations operations, string resource (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + public static AgentPoolUpgradeProfile GetUpgradeProfile(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + { + return operations.GetUpgradeProfileAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetUpgradeProfileAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUpgradeProfileWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + public static AgentPoolAvailableVersions GetAvailableAgentPoolVersions(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAvailableAgentPoolVersionsAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAvailableAgentPoolVersionsAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAvailableAgentPoolVersionsWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates an agent pool. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs index b8ec9621329d..564aab684620 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs @@ -735,7 +735,7 @@ internal ContainerServicesOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs index fe31c66be91b..40bf792cb96b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs @@ -148,6 +148,66 @@ public partial interface IAgentPoolsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a + /// specified resource group and managed cluster name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetUpgradeProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates an agent pool. /// /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs index b42496c1c241..f4c6fb41f833 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs @@ -84,7 +84,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -278,7 +278,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -496,7 +496,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -723,7 +723,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -945,7 +945,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1165,7 +1165,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1385,7 +1385,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1756,7 +1756,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2003,7 +2003,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; TagsObject parameters = new TagsObject(); if (tags != null) { @@ -2231,7 +2231,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2441,7 +2441,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2658,7 +2658,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs index 62d800ddd453..17ca5dc61071 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs @@ -123,7 +123,17 @@ public AgentPool() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) : base(id, name, type) { Count = count; @@ -139,6 +149,10 @@ public AgentPool() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -291,6 +305,35 @@ public AgentPool() [JsonProperty(PropertyName = "properties.availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "properties.enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "properties.scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "properties.scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "properties.nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs new file mode 100644 index 000000000000..aef063574593 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available versions for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolAvailableVersions + { + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + public AgentPoolAvailableVersions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + /// Id of the agent pool available versions. + /// Name of the agent pool available + /// versions. + /// Type of the agent pool available + /// versions. + /// List of versions available for + /// agent pool. + public AgentPoolAvailableVersions(string id = default(string), string name = default(string), string type = default(string), IList agentPoolVersions = default(IList)) + { + Id = id; + Name = name; + Type = type; + AgentPoolVersions = agentPoolVersions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool available versions. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool available versions. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool available versions. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets list of versions available for agent pool. + /// + [JsonProperty(PropertyName = "properties.agentPoolVersions")] + public IList AgentPoolVersions { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs new file mode 100644 index 000000000000..8642c1dbda4c --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs @@ -0,0 +1,70 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem + { + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + /// Whether this version is the default + /// agent pool version. + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(bool? defaultProperty = default(bool?), string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + DefaultProperty = defaultProperty; + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether this version is the default agent pool + /// version. + /// + [JsonProperty(PropertyName = "default")] + public bool? DefaultProperty { get; set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs new file mode 100644 index 000000000000..7e876988de79 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available upgrades for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolUpgradeProfile + { + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + public AgentPoolUpgradeProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// OsType to be used to specify os type. Choose + /// from Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// Id of the agent pool upgrade profile. + /// Name of the agent pool upgrade profile. + /// Type of the agent pool upgrade profile. + /// List of orchestrator types and versions + /// available for upgrade. + public AgentPoolUpgradeProfile(string kubernetesVersion, string osType, string id = default(string), string name = default(string), string type = default(string), IList upgrades = default(IList)) + { + Id = id; + Name = name; + Type = type; + KubernetesVersion = kubernetesVersion; + OsType = osType; + Upgrades = upgrades; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "properties.kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets osType to be used to specify os type. Choose from + /// Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets list of orchestrator types and versions available for + /// upgrade. + /// + [JsonProperty(PropertyName = "properties.upgrades")] + public IList Upgrades { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KubernetesVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KubernetesVersion"); + } + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs new file mode 100644 index 000000000000..e449e974e445 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem + { + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + public AgentPoolUpgradeProfilePropertiesUpgradesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 311110d17c1a..0d1e3604982b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -51,7 +51,9 @@ public ContainerServiceNetworkProfile() /// ranges or the Kubernetes service address range. /// The load balancer sku for the managed /// cluster. Possible values include: 'standard', 'basic' - public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string)) + /// Profile of the cluster load + /// balancer. + public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string), ManagedClusterLoadBalancerProfile loadBalancerProfile = default(ManagedClusterLoadBalancerProfile)) { NetworkPlugin = networkPlugin; NetworkPolicy = networkPolicy; @@ -60,6 +62,7 @@ public ContainerServiceNetworkProfile() DnsServiceIP = dnsServiceIP; DockerBridgeCidr = dockerBridgeCidr; LoadBalancerSku = loadBalancerSku; + LoadBalancerProfile = loadBalancerProfile; CustomInit(); } @@ -119,6 +122,12 @@ public ContainerServiceNetworkProfile() [JsonProperty(PropertyName = "loadBalancerSku")] public string LoadBalancerSku { get; set; } + /// + /// Gets or sets profile of the cluster load balancer. + /// + [JsonProperty(PropertyName = "loadBalancerProfile")] + public ManagedClusterLoadBalancerProfile LoadBalancerProfile { get; set; } + /// /// Validate the object. /// @@ -155,6 +164,10 @@ public virtual void Validate() throw new ValidationException(ValidationRules.Pattern, "DockerBridgeCidr", "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$"); } } + if (LoadBalancerProfile != null) + { + LoadBalancerProfile.Validate(); + } } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs index 7a4181186b42..7fa8fc43785a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs @@ -69,11 +69,11 @@ public ManagedCluster() /// configuration. /// Profile of Azure Active Directory /// configuration. - /// (PREVIEW) Authorized IP - /// Ranges to kubernetes API server. + /// Access profile for managed + /// cluster API server. /// The identity of the managed cluster, if /// configured. - public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), IList apiServerAuthorizedIPRanges = default(IList), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) + public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), ManagedClusterAPIServerAccessProfile apiServerAccessProfile = default(ManagedClusterAPIServerAccessProfile), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) : base(location, id, name, type, tags) { ProvisioningState = provisioningState; @@ -91,7 +91,7 @@ public ManagedCluster() EnablePodSecurityPolicy = enablePodSecurityPolicy; NetworkProfile = networkProfile; AadProfile = aadProfile; - ApiServerAuthorizedIPRanges = apiServerAuthorizedIPRanges; + ApiServerAccessProfile = apiServerAccessProfile; Identity = identity; CustomInit(); } @@ -201,11 +201,10 @@ public ManagedCluster() public ManagedClusterAADProfile AadProfile { get; set; } /// - /// Gets or sets (PREVIEW) Authorized IP Ranges to kubernetes API - /// server. + /// Gets or sets access profile for managed cluster API server. /// - [JsonProperty(PropertyName = "properties.apiServerAuthorizedIPRanges")] - public IList ApiServerAuthorizedIPRanges { get; set; } + [JsonProperty(PropertyName = "properties.apiServerAccessProfile")] + public ManagedClusterAPIServerAccessProfile ApiServerAccessProfile { get; set; } /// /// Gets or sets the identity of the managed cluster, if configured. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs new file mode 100644 index 000000000000..a950f33365d1 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access profile for managed cluster API server. + /// + public partial class ManagedClusterAPIServerAccessProfile + { + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + public ManagedClusterAPIServerAccessProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + /// Authorized IP Ranges to kubernetes + /// API server. + /// Whether to create the cluster as + /// a private cluster or not. + public ManagedClusterAPIServerAccessProfile(IList authorizedIPRanges = default(IList), bool? enablePrivateCluster = default(bool?)) + { + AuthorizedIPRanges = authorizedIPRanges; + EnablePrivateCluster = enablePrivateCluster; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authorized IP Ranges to kubernetes API server. + /// + [JsonProperty(PropertyName = "authorizedIPRanges")] + public IList AuthorizedIPRanges { get; set; } + + /// + /// Gets or sets whether to create the cluster as a private cluster or + /// not. + /// + [JsonProperty(PropertyName = "enablePrivateCluster")] + public bool? EnablePrivateCluster { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 357545428fe3..107edfb3be3d 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -120,8 +120,18 @@ public ManagedClusterAgentPoolProfile() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) - : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) + : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones, enableNodePublicIP, scaleSetPriority, scaleSetEvictionPolicy, nodeTaints) { Name = name; CustomInit(); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index 6e86f0cc9df6..a99b90999b08 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -118,7 +118,17 @@ public ManagedClusterAgentPoolProfileProperties() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) { Count = count; VmSize = vmSize; @@ -133,6 +143,10 @@ public ManagedClusterAgentPoolProfileProperties() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -285,6 +299,35 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs new file mode 100644 index 000000000000..2c9728a8cd0d --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -0,0 +1,100 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile of the managed cluster load balancer + /// + public partial class ManagedClusterLoadBalancerProfile + { + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + public ManagedClusterLoadBalancerProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + /// Desired managed outbound IPs for + /// the cluster load balancer. + /// Desired outbound IP Prefix + /// resources for the cluster load balancer. + /// Desired outbound IP resources for the + /// cluster load balancer. + /// The effective outbound IP + /// resources of the cluster load balancer. + public ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default(ManagedClusterLoadBalancerProfileManagedOutboundIPs), ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default(ManagedClusterLoadBalancerProfileOutboundIPPrefixes), ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default(ManagedClusterLoadBalancerProfileOutboundIPs), IList effectiveOutboundIPs = default(IList)) + { + ManagedOutboundIPs = managedOutboundIPs; + OutboundIPPrefixes = outboundIPPrefixes; + OutboundIPs = outboundIPs; + EffectiveOutboundIPs = effectiveOutboundIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired managed outbound IPs for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "managedOutboundIPs")] + public ManagedClusterLoadBalancerProfileManagedOutboundIPs ManagedOutboundIPs { get; set; } + + /// + /// Gets or sets desired outbound IP Prefix resources for the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "outboundIPPrefixes")] + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes OutboundIPPrefixes { get; set; } + + /// + /// Gets or sets desired outbound IP resources for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "outboundIPs")] + public ManagedClusterLoadBalancerProfileOutboundIPs OutboundIPs { get; set; } + + /// + /// Gets or sets the effective outbound IP resources of the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "effectiveOutboundIPs")] + public IList EffectiveOutboundIPs { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedOutboundIPs != null) + { + ManagedOutboundIPs.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs new file mode 100644 index 000000000000..d72f7f793e37 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs @@ -0,0 +1,75 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Desired managed outbound IPs for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileManagedOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + /// Desired number of outbound IP created/managed + /// by Azure for the cluster load balancer. Allowed values must be in + /// the range of 1 to 100 (inclusive). The default value is 1. + public ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count = default(int?)) + { + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired number of outbound IP created/managed by Azure + /// for the cluster load balancer. Allowed values must be in the range + /// of 1 to 100 (inclusive). The default value is 1. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Count > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Count", 100); + } + if (Count < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Count", 1); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs new file mode 100644 index 000000000000..e4220de6974b --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP Prefix resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + /// A list of public IP prefix + /// resources. + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes = default(IList)) + { + PublicIPPrefixes = publicIPPrefixes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP prefix resources. + /// + [JsonProperty(PropertyName = "publicIPPrefixes")] + public IList PublicIPPrefixes { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs new file mode 100644 index 000000000000..8c6863afa7cb --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + /// A list of public IP resources. + public ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs = default(IList)) + { + PublicIPs = publicIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP resources. + /// + [JsonProperty(PropertyName = "publicIPs")] + public IList PublicIPs { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs new file mode 100644 index 000000000000..d272c94add12 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A reference to an Azure resource. + /// + public partial class ResourceReference + { + /// + /// Initializes a new instance of the ResourceReference class. + /// + public ResourceReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceReference class. + /// + /// The fully qualified Azure 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 the fully qualified Azure resource id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs new file mode 100644 index 000000000000..25bd3db49c44 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.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.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetEvictionPolicy. + /// + public static class ScaleSetEvictionPolicy + { + public const string Delete = "Delete"; + public const string Deallocate = "Deallocate"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs new file mode 100644 index 000000000000..5edcae14e830 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.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.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetPriority. + /// + public static class ScaleSetPriority + { + public const string Low = "Low"; + public const string Regular = "Regular"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs index ec90823197fa..33c25ec737fe 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(ContainerServiceClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs index e35757d72020..2330060e78a7 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs @@ -19,12 +19,12 @@ public static IEnumerable> ApiInfo_ContainerServic { return new Tuple[] { - new Tuple("ContainerService", "AgentPools", "2019-04-01"), + new Tuple("ContainerService", "AgentPools", "2019-08-01"), new Tuple("ContainerService", "ContainerServices", "2017-07-01"), - new Tuple("ContainerService", "ContainerServices", "2019-04-01"), - new Tuple("ContainerService", "ManagedClusters", "2019-04-01"), + new Tuple("ContainerService", "ContainerServices", "2019-08-01"), + new Tuple("ContainerService", "ManagedClusters", "2019-08-01"), new Tuple("ContainerService", "OpenShiftManagedClusters", "2019-04-30"), - new Tuple("ContainerService", "Operations", "2019-04-01"), + new Tuple("ContainerService", "Operations", "2019-08-01"), }.AsEnumerable(); } } From 2ff29a49a542d50225ed010c390fa942f1573860 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2019 03:10:48 +0000 Subject: [PATCH 3/5] [AutoPR Microsoft.Azure.Management.CostManagement] Supporting Management Group scope for Exports (#94) * Update swagger_to_sdk_config.json * Update swagger_to_sdk_config.json * Update swagger_to_sdk_config.json * Update swagger_to_sdk_config.json * Generated from 967f9659d62a831649ef83f6a52cf2e35dbb87bd Fixed model validation --- .../src/Generated/BudgetOperations.cs | 673 ++++++ .../Generated/BudgetOperationsExtensions.cs | 248 +++ .../src/Generated/BudgetsOperations.cs | 416 ++++ .../Generated/BudgetsOperationsExtensions.cs | 127 ++ .../src/Generated/CostManagementClient.cs | 376 ++++ .../src/Generated/IBudgetOperations.cs | 153 ++ .../src/Generated/IBudgetsOperations.cs | 88 + .../src/Generated/ICostManagementClient.cs | 93 + .../src/Generated/IOperations.cs | 68 + .../src/Generated/IViewsOperations.cs | 345 +++ .../src/Generated/Models/AccumulatedType.cs | 22 + .../src/Generated/Models/BudgetModel.cs | 172 ++ .../src/Generated/Models/BudgetTimePeriod.cs | 71 + .../src/Generated/Models/CategoryType.cs | 22 + .../src/Generated/Models/ChartType.cs | 25 + .../src/Generated/Models/CurrentSpend.cs | 61 + .../src/Generated/Models/ErrorBase.cs | 69 + .../src/Generated/Models/ErrorDetails.cs | 79 + .../src/Generated/Models/ErrorResponse.cs | 52 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/GranularityType.cs | 22 + .../src/Generated/Models/KpiProperties.cs | 69 + .../src/Generated/Models/KpiTypeType.cs | 22 + .../src/Generated/Models/MetricType.cs | 23 + .../src/Generated/Models/Notification.cs | 147 ++ .../Models/NotificationOperatorType.cs | 23 + .../src/Generated/Models/Operation.cs | 61 + .../src/Generated/Models/OperationDisplay.cs | 71 + .../src/Generated/Models/OperatorType.cs | 22 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/PivotProperties.cs | 61 + .../src/Generated/Models/PivotTypeType.cs | 22 + .../src/Generated/Models/ProxyResource.cs | 81 + .../Models/ReportConfigAggregation.cs | 78 + .../Models/ReportConfigColumnType.cs | 22 + .../ReportConfigComparisonExpression.cs | 103 + .../Generated/Models/ReportConfigDataset.cs | 156 ++ .../ReportConfigDatasetConfiguration.cs | 59 + .../Generated/Models/ReportConfigFilter.cs | 140 ++ .../Generated/Models/ReportConfigGrouping.cs | 81 + .../Generated/Models/ReportConfigSorting.cs | 75 + .../Models/ReportConfigTimePeriod.cs | 70 + .../src/Generated/Models/Resource.cs | 79 + .../src/Generated/Models/Scope.cs | 73 + .../src/Generated/Models/TimeGrainType.cs | 23 + .../src/Generated/Models/TimeframeType.cs | 24 + .../src/Generated/Models/View.cs | 245 +++ .../src/Generated/Operations.cs | 390 ++++ .../src/Generated/OperationsExtensions.cs | 87 + .../Generated/SdkInfo_CostManagementClient.cs | 30 + .../src/Generated/ViewsOperations.cs | 1944 +++++++++++++++++ .../Generated/ViewsOperationsExtensions.cs | 563 +++++ 52 files changed, 8141 insertions(+) create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs new file mode 100644 index 000000000000..1488b669385c --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs @@ -0,0 +1,673 @@ +// +// 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.CostManagement +{ + 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; + + /// + /// BudgetOperations operations. + /// + internal partial class BudgetOperations : IServiceOperations, IBudgetOperations + { + /// + /// Initializes a new instance of the BudgetOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BudgetOperations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (budgetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "budgetName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("budgetName", budgetName); + 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("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName)); + 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; + } + + /// + /// The operation to create or update a budget. Update operation requires + /// latest eTag to be set in the request mandatorily. You may obtain the latest + /// eTag by performing a get operation. Create operation does not require eTag. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget 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> CreateOrUpdateWithHttpMessagesAsync(string scope, string budgetName, BudgetModel parameters = default(BudgetModel), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (budgetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "budgetName"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("budgetName", budgetName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a budget. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// 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 scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (budgetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "budgetName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("budgetName", budgetName); + 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("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName)); + 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 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; + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs new file mode 100644 index 000000000000..5919a270dc00 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs @@ -0,0 +1,248 @@ +// +// 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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BudgetOperations. + /// + public static partial class BudgetOperationsExtensions + { + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + public static BudgetModel Get(this IBudgetOperations operations, string scope, string budgetName) + { + return operations.GetAsync(scope, budgetName).GetAwaiter().GetResult(); + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a budget. Update operation requires + /// latest eTag to be set in the request mandatorily. You may obtain the latest + /// eTag by performing a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget operation. + /// + public static BudgetModel CreateOrUpdate(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel)) + { + return operations.CreateOrUpdateAsync(scope, budgetName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a budget. Update operation requires + /// latest eTag to be set in the request mandatorily. You may obtain the latest + /// eTag by performing a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, budgetName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a budget. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + public static void Delete(this IBudgetOperations operations, string scope, string budgetName) + { + operations.DeleteAsync(scope, budgetName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a budget. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs new file mode 100644 index 000000000000..740ee449c11c --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs @@ -0,0 +1,416 @@ +// +// 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.CostManagement +{ + 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; + + /// + /// BudgetsOperations operations. + /// + internal partial class BudgetsOperations : IServiceOperations, IBudgetsOperations + { + /// + /// Initializes a new instance of the BudgetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BudgetsOperations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + 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("scope", scope); + 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("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/budgets").ToString(); + _url = _url.Replace("{scope}", scope); + 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 budgets for the defined scope. + /// + /// + /// + /// 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs new file mode 100644 index 000000000000..49ef9a595787 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs @@ -0,0 +1,127 @@ +// +// 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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BudgetsOperations. + /// + public static partial class BudgetsOperationsExtensions + { + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + public static IPage List(this IBudgetsOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBudgetsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBudgetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// 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 IBudgetsOperations 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs new file mode 100644 index 000000000000..8ff8db2530de --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs @@ -0,0 +1,376 @@ +// +// 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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + public partial class CostManagementClient : ServiceClient, ICostManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Version of the API to be used with the client request. The current version + /// is 2019-04-01-preview + /// + public string ApiVersion { get; private set; } + + /// + /// Azure Subscription ID. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IViewsOperations. + /// + public virtual IViewsOperations Views { get; private set; } + + /// + /// Gets the IBudgetsOperations. + /// + public virtual IBudgetsOperations Budgets { get; private set; } + + /// + /// Gets the IBudgetOperations. + /// + public virtual IBudgetOperations Budget { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling CostManagementClient.Dispose(). False: will not dispose provided httpClient + protected CostManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected CostManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected CostManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected CostManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected CostManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling CostManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the CostManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Views = new ViewsOperations(this); + Budgets = new BudgetsOperations(this); + Budget = new BudgetOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2019-04-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs new file mode 100644 index 000000000000..743b05022b2e --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs @@ -0,0 +1,153 @@ +// +// 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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BudgetOperations operations. + /// + public partial interface IBudgetOperations + { + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a budget. Update operation + /// requires latest eTag to be set in the request mandatorily. You may + /// obtain the latest eTag by performing a get operation. Create + /// operation does not require eTag. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// Parameters supplied to the Create Budget operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string budgetName, BudgetModel parameters = default(BudgetModel), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a budget. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// Budget Name. + /// + /// + /// 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 scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs new file mode 100644 index 000000000000..099bc5547849 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BudgetsOperations operations. + /// + public partial interface IBudgetsOperations + { + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// The scope associated with budget operations. This includes + /// '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope. + /// + /// + /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all budgets for the defined scope. + /// + /// + /// + /// 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs new file mode 100644 index 000000000000..40487d0d7060 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface ICostManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// Version of the API to be used with the client request. The current + /// version is 2019-04-01-preview + /// + string ApiVersion { get; } + + /// + /// Azure Subscription ID. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IViewsOperations. + /// + IViewsOperations Views { get; } + + /// + /// Gets the IBudgetsOperations. + /// + IBudgetsOperations Budgets { get; } + + /// + /// Gets the IBudgetOperations. + /// + IBudgetOperations Budget { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs new file mode 100644 index 000000000000..9efcc4fb3e1b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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 of the available consumption REST API operations. + /// + /// + /// 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs new file mode 100644 index 000000000000..113b114257aa --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs @@ -0,0 +1,345 @@ +// +// 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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ViewsOperations operations. + /// + public partial interface IViewsOperations + { + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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 views at the given scope. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// 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>> ListByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the view by view name. + /// + /// + /// + /// View name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a view. Update operation requires + /// latest eTag to be set in the request. You may obtain the latest + /// eTag by performing a get operation. Create operation does not + /// require eTag. + /// + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a view. + /// + /// + /// + /// View name + /// + /// + /// 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 viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create or update a view. Update operation requires + /// latest eTag to be set in the request. You may obtain the latest + /// eTag by performing a get operation. Create operation does not + /// require eTag. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to delete a view. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// 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 DeleteByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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)); + /// + /// Lists all views at the given scope. + /// + /// + /// + /// 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>> ListByScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs new file mode 100644 index 000000000000..a2e19985def0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.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.CostManagement.Models +{ + + /// + /// Defines values for AccumulatedType. + /// + public static class AccumulatedType + { + public const string True = "true"; + public const string False = "false"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs new file mode 100644 index 000000000000..1ac6c00a01c0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs @@ -0,0 +1,172 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A budget resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class BudgetModel : ProxyResource + { + /// + /// Initializes a new instance of the BudgetModel class. + /// + public BudgetModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetModel class. + /// + /// The category of the budget, whether the + /// budget tracks cost or usage. Possible values include: 'Cost', + /// 'Usage' + /// The total amount of cost to track with the + /// budget + /// The time covered by a budget. Tracking of + /// the amount will be reset based on the time grain. Possible values + /// include: 'Monthly', 'Quarterly', 'Annually' + /// Has start and end date of the budget. The + /// start date must be first of the month and should be less than the + /// end date. Budget start date must be on or after June 1, 2017. + /// Future start date should not be more than three months. Past start + /// date should be selected within the timegrain period. There are no + /// restrictions on the end date. + /// Resource Id. + /// Resource name. + /// Resource type. + /// eTag of the resource. To handle concurrent + /// update scenario, this field will be used to determine whether the + /// user is updating the latest version or not. + /// May be used to filter budgets. + /// The current amount of cost which is + /// being tracked for a budget. + /// Dictionary of notifications associated + /// with the budget. Budget can have up to five notifications. + public BudgetModel(string category, decimal amount, string timeGrain, BudgetTimePeriod timePeriod, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), ReportConfigFilter filter = default(ReportConfigFilter), CurrentSpend currentSpend = default(CurrentSpend), IDictionary notifications = default(IDictionary)) + : base(id, name, type, eTag) + { + Category = category; + Amount = amount; + TimeGrain = timeGrain; + TimePeriod = timePeriod; + Filter = filter; + CurrentSpend = currentSpend; + Notifications = notifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the category of the budget, whether the budget tracks + /// cost or usage. Possible values include: 'Cost', 'Usage' + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; set; } + + /// + /// Gets or sets the total amount of cost to track with the budget + /// + [JsonProperty(PropertyName = "properties.amount")] + public decimal Amount { get; set; } + + /// + /// Gets or sets the time covered by a budget. Tracking of the amount + /// will be reset based on the time grain. Possible values include: + /// 'Monthly', 'Quarterly', 'Annually' + /// + [JsonProperty(PropertyName = "properties.timeGrain")] + public string TimeGrain { get; set; } + + /// + /// Gets or sets has start and end date of the budget. The start date + /// must be first of the month and should be less than the end date. + /// Budget start date must be on or after June 1, 2017. Future start + /// date should not be more than three months. Past start date should + /// be selected within the timegrain period. There are no restrictions + /// on the end date. + /// + [JsonProperty(PropertyName = "properties.timePeriod")] + public BudgetTimePeriod TimePeriod { get; set; } + + /// + /// Gets or sets may be used to filter budgets. + /// + [JsonProperty(PropertyName = "properties.filter")] + public ReportConfigFilter Filter { get; set; } + + /// + /// Gets the current amount of cost which is being tracked for a + /// budget. + /// + [JsonProperty(PropertyName = "properties.currentSpend")] + public CurrentSpend CurrentSpend { get; private set; } + + /// + /// Gets or sets dictionary of notifications associated with the + /// budget. Budget can have up to five notifications. + /// + [JsonProperty(PropertyName = "properties.notifications")] + public IDictionary Notifications { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Category == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Category"); + } + if (TimeGrain == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeGrain"); + } + if (TimePeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimePeriod"); + } + if (TimePeriod != null) + { + TimePeriod.Validate(); + } + if (Filter != null) + { + Filter.Validate(); + } + if (Notifications != null) + { + foreach (var valueElement in Notifications.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs new file mode 100644 index 000000000000..eabff2337f19 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The start and end date for a budget. + /// + public partial class BudgetTimePeriod + { + /// + /// Initializes a new instance of the BudgetTimePeriod class. + /// + public BudgetTimePeriod() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetTimePeriod class. + /// + /// The start date for the budget. + /// The end date for the budget. If not provided, + /// we default this to 10 years from the start date. + public BudgetTimePeriod(System.DateTime startDate, System.DateTime? endDate = default(System.DateTime?)) + { + StartDate = startDate; + EndDate = endDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start date for the budget. + /// + [JsonProperty(PropertyName = "startDate")] + public System.DateTime StartDate { get; set; } + + /// + /// Gets or sets the end date for the budget. If not provided, we + /// default this to 10 years from the start date. + /// + [JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs new file mode 100644 index 000000000000..4851e4efbf90 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.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.CostManagement.Models +{ + + /// + /// Defines values for CategoryType. + /// + public static class CategoryType + { + public const string Cost = "Cost"; + public const string Usage = "Usage"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs new file mode 100644 index 000000000000..0e72be35a68f --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.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.CostManagement.Models +{ + + /// + /// Defines values for ChartType. + /// + public static class ChartType + { + public const string Area = "Area"; + public const string Line = "Line"; + public const string StackedColumn = "StackedColumn"; + public const string GroupedColumn = "GroupedColumn"; + public const string Table = "Table"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs new file mode 100644 index 000000000000..800a08039911 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs @@ -0,0 +1,61 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The current amount of cost which is being tracked for a budget. + /// + public partial class CurrentSpend + { + /// + /// Initializes a new instance of the CurrentSpend class. + /// + public CurrentSpend() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CurrentSpend class. + /// + /// The total amount of cost which is being + /// tracked by the budget. + /// The unit of measure for the budget + /// amount. + public CurrentSpend(decimal? amount = default(decimal?), string unit = default(string)) + { + Amount = amount; + Unit = unit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the total amount of cost which is being tracked by the budget. + /// + [JsonProperty(PropertyName = "amount")] + public decimal? Amount { get; private set; } + + /// + /// Gets the unit of measure for the budget amount. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs new file mode 100644 index 000000000000..e01c15ea507b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs @@ -0,0 +1,69 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details of the error. + /// + public partial class ErrorBase + { + /// + /// Initializes a new instance of the ErrorBase class. + /// + public ErrorBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorBase class. + /// + /// A machine readable error code. + /// A human readable error message. + /// Indicates which property in the request is + /// responsible for the error. + public ErrorBase(string code = default(string), string message = default(string), string target = default(string)) + { + Code = code; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a machine readable error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets a human readable error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets indicates which property in the request is responsible for the + /// error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs new file mode 100644 index 000000000000..1386766cdbb3 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs @@ -0,0 +1,79 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The details of the error. + /// + public partial class ErrorDetails + { + /// + /// Initializes a new instance of the ErrorDetails class. + /// + public ErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetails class. + /// + /// A machine readable error code. + /// A human readable error message. + /// Indicates which property in the request is + /// responsible for the error. + /// error details. + public ErrorDetails(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a machine readable error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets a human readable error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets or sets indicates which property in the request is responsible + /// for the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..de6105c004da --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,52 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response indicates that the service is not able to process the + /// incoming request. The reason is provided in the error message. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The details of the error. + public ErrorResponse(ErrorDetails error = default(ErrorDetails)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the details of the error. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetails Error { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..a464dabb029b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs new file mode 100644 index 000000000000..b259cfb98f3d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.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.CostManagement.Models +{ + + /// + /// Defines values for GranularityType. + /// + public static class GranularityType + { + public const string Daily = "Daily"; + public const string Monthly = "Monthly"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs new file mode 100644 index 000000000000..2b73b6d962e2 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs @@ -0,0 +1,69 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Each KPI must contain a 'type' and 'enabled' key. + /// + public partial class KpiProperties + { + /// + /// Initializes a new instance of the KpiProperties class. + /// + public KpiProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KpiProperties class. + /// + /// KPI type (Forecast, Budget). Possible values + /// include: 'Forecast', 'Budget' + /// ID of resource related to metric (budget). + /// show the KPI in the UI? + public KpiProperties(string type = default(string), string id = default(string), bool? enabled = default(bool?)) + { + Type = type; + Id = id; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets KPI type (Forecast, Budget). Possible values include: + /// 'Forecast', 'Budget' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets ID of resource related to metric (budget). + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets show the KPI in the UI? + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs new file mode 100644 index 000000000000..735baa7d36b3 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.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.CostManagement.Models +{ + + /// + /// Defines values for KpiTypeType. + /// + public static class KpiTypeType + { + public const string Forecast = "Forecast"; + public const string Budget = "Budget"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs new file mode 100644 index 000000000000..746d4df6e4d8 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.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.CostManagement.Models +{ + + /// + /// Defines values for MetricType. + /// + public static class MetricType + { + public const string ActualCost = "ActualCost"; + public const string AmortizedCost = "AmortizedCost"; + public const string AHUB = "AHUB"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs new file mode 100644 index 000000000000..a208ee8129c4 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs @@ -0,0 +1,147 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The notification associated with a budget. + /// + public partial class Notification + { + /// + /// Initializes a new instance of the Notification class. + /// + public Notification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Notification class. + /// + /// The notification is enabled or not. + /// The comparison operator. Possible + /// values include: 'EqualTo', 'GreaterThan', + /// 'GreaterThanOrEqualTo' + /// Threshold value associated with a + /// notification. Notification is sent when the cost exceeded the + /// threshold. It is always percent and has to be between 0 and + /// 1000. + /// Email addresses to send the budget + /// notification to when the threshold is exceeded. + /// Contact roles to send the budget + /// notification to when the threshold is exceeded. + /// Action groups to send the budget + /// notification to when the threshold is exceeded. + public Notification(bool enabled, string operatorProperty, decimal threshold, IList contactEmails, IList contactRoles = default(IList), IList contactGroups = default(IList)) + { + Enabled = enabled; + OperatorProperty = operatorProperty; + Threshold = threshold; + ContactEmails = contactEmails; + ContactRoles = contactRoles; + ContactGroups = contactGroups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the notification is enabled or not. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets the comparison operator. Possible values include: + /// 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets threshold value associated with a notification. + /// Notification is sent when the cost exceeded the threshold. It is + /// always percent and has to be between 0 and 1000. + /// + [JsonProperty(PropertyName = "threshold")] + public decimal Threshold { get; set; } + + /// + /// Gets or sets email addresses to send the budget notification to + /// when the threshold is exceeded. + /// + [JsonProperty(PropertyName = "contactEmails")] + public IList ContactEmails { get; set; } + + /// + /// Gets or sets contact roles to send the budget notification to when + /// the threshold is exceeded. + /// + [JsonProperty(PropertyName = "contactRoles")] + public IList ContactRoles { get; set; } + + /// + /// Gets or sets action groups to send the budget notification to when + /// the threshold is exceeded. + /// + [JsonProperty(PropertyName = "contactGroups")] + public IList ContactGroups { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (ContactEmails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContactEmails"); + } + if (ContactEmails != null) + { + if (ContactEmails.Count > 50) + { + throw new ValidationException(ValidationRules.MaxItems, "ContactEmails", 50); + } + if (ContactEmails.Count < 1) + { + throw new ValidationException(ValidationRules.MinItems, "ContactEmails", 1); + } + } + if (ContactGroups != null) + { + if (ContactGroups.Count > 50) + { + throw new ValidationException(ValidationRules.MaxItems, "ContactGroups", 50); + } + if (ContactGroups.Count < 0) + { + throw new ValidationException(ValidationRules.MinItems, "ContactGroups", 0); + } + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs new file mode 100644 index 000000000000..e5b8501977e2 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.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.CostManagement.Models +{ + + /// + /// Defines values for NotificationOperatorType. + /// + public static class NotificationOperatorType + { + public const string EqualTo = "EqualTo"; + public const string GreaterThan = "GreaterThan"; + public const string GreaterThanOrEqualTo = "GreaterThanOrEqualTo"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..bed6fe698a61 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs @@ -0,0 +1,61 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Cost management REST API operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation}. + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name: {provider}/{resource}/{operation}. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..b8731cf3636b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: + /// Microsoft.CostManagement. + /// Resource on which the operation is + /// performed: Dimensions, Query. + /// Operation type: Read, write, delete, + /// etc. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service provider: Microsoft.CostManagement. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource on which the operation is performed: Dimensions, + /// Query. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets operation type: Read, write, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs new file mode 100644 index 000000000000..04835817077f --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.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.CostManagement.Models +{ + + /// + /// Defines values for OperatorType. + /// + public static class OperatorType + { + public const string In = "In"; + public const string Contains = "Contains"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..a431dbedbb4d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.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.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs new file mode 100644 index 000000000000..7761b4a3ea87 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs @@ -0,0 +1,61 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Each pivot must contain a 'type' and 'name'. + /// + public partial class PivotProperties + { + /// + /// Initializes a new instance of the PivotProperties class. + /// + public PivotProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PivotProperties class. + /// + /// Data type to show in view. Possible values + /// include: 'Dimension', 'TagKey' + /// Data field to show in view. + public PivotProperties(string type = default(string), string name = default(string)) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type to show in view. Possible values include: + /// 'Dimension', 'TagKey' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets data field to show in view. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs new file mode 100644 index 000000000000..01ce2abd7bb7 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.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.CostManagement.Models +{ + + /// + /// Defines values for PivotTypeType. + /// + public static class PivotTypeType + { + public const string Dimension = "Dimension"; + public const string TagKey = "TagKey"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..d38be096c86a --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,81 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class ProxyResource : IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// eTag of the resource. To handle concurrent + /// update scenario, this field will be used to determine whether the + /// user is updating the latest version or not. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string)) + { + Id = id; + Name = name; + Type = type; + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets eTag of the resource. To handle concurrent update + /// scenario, this field will be used to determine whether the user is + /// updating the latest version or not. + /// + [JsonProperty(PropertyName = "eTag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs new file mode 100644 index 000000000000..0f65a66d0699 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The aggregation expression to be used in the report. + /// + public partial class ReportConfigAggregation + { + /// + /// Initializes a new instance of the ReportConfigAggregation class. + /// + public ReportConfigAggregation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigAggregation class. + /// + /// The name of the column to aggregate. + public ReportConfigAggregation(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for ReportConfigAggregation class. + /// + static ReportConfigAggregation() + { + Function = "Sum"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the column to aggregate. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The name of the aggregation function to use. + /// + [JsonProperty(PropertyName = "function")] + public static string Function { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs new file mode 100644 index 000000000000..1f891b17234d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.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.CostManagement.Models +{ + + /// + /// Defines values for ReportConfigColumnType. + /// + public static class ReportConfigColumnType + { + public const string Tag = "Tag"; + public const string Dimension = "Dimension"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs new file mode 100644 index 000000000000..61dc4e845a91 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.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.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The comparison expression to be used in the report. + /// + public partial class ReportConfigComparisonExpression + { + /// + /// Initializes a new instance of the ReportConfigComparisonExpression + /// class. + /// + public ReportConfigComparisonExpression() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigComparisonExpression + /// class. + /// + /// The name of the column to use in + /// comparison. + /// The operator to use for comparison. + /// Possible values include: 'In', 'Contains' + /// Array of values to use for comparison + public ReportConfigComparisonExpression(string name, string operatorProperty, IList values) + { + Name = name; + OperatorProperty = operatorProperty; + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the column to use in comparison. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the operator to use for comparison. Possible values + /// include: 'In', 'Contains' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets array of values to use for comparison + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + if (Values != null) + { + if (Values.Count < 1) + { + throw new ValidationException(ValidationRules.MinItems, "Values", 1); + } + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs new file mode 100644 index 000000000000..605ea38bf627 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs @@ -0,0 +1,156 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The definition of data present in the report. + /// + public partial class ReportConfigDataset + { + /// + /// Initializes a new instance of the ReportConfigDataset class. + /// + public ReportConfigDataset() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigDataset class. + /// + /// The granularity of rows in the report. + /// Possible values include: 'Daily', 'Monthly' + /// Has configuration information for the + /// data in the report. The configuration will be ignored if + /// aggregation and grouping are provided. + /// Dictionary of aggregation expression to + /// use in the report. The key of each item in the dictionary is the + /// alias for the aggregated column. Report can have up to 2 + /// aggregation clauses. + /// Array of group by expression to use in the + /// report. Report can have up to 2 group by clauses. + /// Array of order by expression to use in the + /// report. + /// Has filter expression to use in the + /// report. + public ReportConfigDataset(string granularity = default(string), ReportConfigDatasetConfiguration configuration = default(ReportConfigDatasetConfiguration), IDictionary aggregation = default(IDictionary), IList grouping = default(IList), IList sorting = default(IList), ReportConfigFilter filter = default(ReportConfigFilter)) + { + Granularity = granularity; + Configuration = configuration; + Aggregation = aggregation; + Grouping = grouping; + Sorting = sorting; + Filter = filter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the granularity of rows in the report. Possible values + /// include: 'Daily', 'Monthly' + /// + [JsonProperty(PropertyName = "granularity")] + public string Granularity { get; set; } + + /// + /// Gets or sets has configuration information for the data in the + /// report. The configuration will be ignored if aggregation and + /// grouping are provided. + /// + [JsonProperty(PropertyName = "configuration")] + public ReportConfigDatasetConfiguration Configuration { get; set; } + + /// + /// Gets or sets dictionary of aggregation expression to use in the + /// report. The key of each item in the dictionary is the alias for the + /// aggregated column. Report can have up to 2 aggregation clauses. + /// + [JsonProperty(PropertyName = "aggregation")] + public IDictionary Aggregation { get; set; } + + /// + /// Gets or sets array of group by expression to use in the report. + /// Report can have up to 2 group by clauses. + /// + [JsonProperty(PropertyName = "grouping")] + public IList Grouping { get; set; } + + /// + /// Gets or sets array of order by expression to use in the report. + /// + [JsonProperty(PropertyName = "sorting")] + public IList Sorting { get; set; } + + /// + /// Gets or sets has filter expression to use in the report. + /// + [JsonProperty(PropertyName = "filter")] + public ReportConfigFilter Filter { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Aggregation != null) + { + foreach (var valueElement in Aggregation.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (Grouping != null) + { + if (Grouping.Count > 2) + { + throw new ValidationException(ValidationRules.MaxItems, "Grouping", 2); + } + foreach (var element in Grouping) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Sorting != null) + { + foreach (var element1 in Sorting) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Filter != null) + { + Filter.Validate(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs new file mode 100644 index 000000000000..eeb8dc20dc98 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs @@ -0,0 +1,59 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The configuration of dataset in the report. + /// + public partial class ReportConfigDatasetConfiguration + { + /// + /// Initializes a new instance of the ReportConfigDatasetConfiguration + /// class. + /// + public ReportConfigDatasetConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigDatasetConfiguration + /// class. + /// + /// Array of column names to be included in the + /// report. Any valid report column name is allowed. If not provided, + /// then report includes all columns. + public ReportConfigDatasetConfiguration(IList columns = default(IList)) + { + Columns = columns; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of column names to be included in the report. + /// Any valid report column name is allowed. If not provided, then + /// report includes all columns. + /// + [JsonProperty(PropertyName = "columns")] + public IList Columns { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs new file mode 100644 index 000000000000..501c07680265 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The filter expression to be used in the report. + /// + public partial class ReportConfigFilter + { + /// + /// Initializes a new instance of the ReportConfigFilter class. + /// + public ReportConfigFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigFilter class. + /// + /// The logical "AND" expression. Must have at least + /// 2 items. + /// The logical "OR" expression. Must have at least 2 + /// items. + /// The logical "NOT" expression. + /// Has comparison expression for a + /// dimension + /// Has comparison expression for a tag + public ReportConfigFilter(IList and = default(IList), IList or = default(IList), ReportConfigFilter not = default(ReportConfigFilter), ReportConfigComparisonExpression dimension = default(ReportConfigComparisonExpression), ReportConfigComparisonExpression tag = default(ReportConfigComparisonExpression)) + { + And = and; + Or = or; + Not = not; + Dimension = dimension; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the logical "AND" expression. Must have at least 2 + /// items. + /// + [JsonProperty(PropertyName = "and")] + public IList And { get; set; } + + /// + /// Gets or sets the logical "OR" expression. Must have at least 2 + /// items. + /// + [JsonProperty(PropertyName = "or")] + public IList Or { get; set; } + + /// + /// Gets or sets the logical "NOT" expression. + /// + [JsonProperty(PropertyName = "not")] + public ReportConfigFilter Not { get; set; } + + /// + /// Gets or sets has comparison expression for a dimension + /// + [JsonProperty(PropertyName = "dimension")] + public ReportConfigComparisonExpression Dimension { get; set; } + + /// + /// Gets or sets has comparison expression for a tag + /// + [JsonProperty(PropertyName = "tag")] + public ReportConfigComparisonExpression Tag { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (And != null) + { + if (And.Count < 2) + { + throw new ValidationException(ValidationRules.MinItems, "And", 2); + } + foreach (var element in And) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Or != null) + { + if (Or.Count < 2) + { + throw new ValidationException(ValidationRules.MinItems, "Or", 2); + } + foreach (var element1 in Or) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Not != null) + { + Not.Validate(); + } + if (Dimension != null) + { + Dimension.Validate(); + } + if (Tag != null) + { + Tag.Validate(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs new file mode 100644 index 000000000000..ce12933eb064 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs @@ -0,0 +1,81 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The group by expression to be used in the report. + /// + public partial class ReportConfigGrouping + { + /// + /// Initializes a new instance of the ReportConfigGrouping class. + /// + public ReportConfigGrouping() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigGrouping class. + /// + /// Has type of the column to group. Possible values + /// include: 'Tag', 'Dimension' + /// The name of the column to group. This version + /// supports subscription lowest possible grain. + public ReportConfigGrouping(string type, string name) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets has type of the column to group. Possible values + /// include: 'Tag', 'Dimension' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the column to group. This version supports + /// subscription lowest possible grain. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs new file mode 100644 index 000000000000..ae83953a20e4 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs @@ -0,0 +1,75 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The order by expression to be used in the report. + /// + public partial class ReportConfigSorting + { + /// + /// Initializes a new instance of the ReportConfigSorting class. + /// + public ReportConfigSorting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigSorting class. + /// + /// The name of the column to sort. + /// Direction of sort. Possible values include: + /// 'Ascending', 'Descending' + public ReportConfigSorting(string name, string direction = default(string)) + { + Direction = direction; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets direction of sort. Possible values include: + /// 'Ascending', 'Descending' + /// + [JsonProperty(PropertyName = "direction")] + public string Direction { get; set; } + + /// + /// Gets or sets the name of the column to sort. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs new file mode 100644 index 000000000000..2c4dabb85457 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs @@ -0,0 +1,70 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The start and end date for pulling data for the report. + /// + public partial class ReportConfigTimePeriod + { + /// + /// Initializes a new instance of the ReportConfigTimePeriod class. + /// + public ReportConfigTimePeriod() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReportConfigTimePeriod class. + /// + /// The start date to pull data + /// from. + /// The end date to pull data to. + public ReportConfigTimePeriod(System.DateTime fromProperty, System.DateTime to) + { + FromProperty = fromProperty; + To = to; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start date to pull data from. + /// + [JsonProperty(PropertyName = "from")] + public System.DateTime FromProperty { get; set; } + + /// + /// Gets or sets the end date to pull data to. + /// + [JsonProperty(PropertyName = "to")] + public System.DateTime To { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..c6dbf27e4db3 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs @@ -0,0 +1,79 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + public Resource(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs new file mode 100644 index 000000000000..daeac5d6a1f9 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs @@ -0,0 +1,73 @@ +// +// 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.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Scope model definition + /// + public partial class Scope + { + /// + /// Initializes a new instance of the Scope class. + /// + public Scope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Scope class. + /// + /// Scope id + /// Scope name + /// Scope type + public Scope(string id = default(string), string name = default(string), string type = default(string), Scope childScope = default(Scope)) + { + Id = id; + Name = name; + Type = type; + ChildScope = childScope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scope id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets scope name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets scope type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "childScope")] + public Scope ChildScope { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs new file mode 100644 index 000000000000..6db6f5f3cb8a --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.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.CostManagement.Models +{ + + /// + /// Defines values for TimeGrainType. + /// + public static class TimeGrainType + { + public const string Monthly = "Monthly"; + public const string Quarterly = "Quarterly"; + public const string Annually = "Annually"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs new file mode 100644 index 000000000000..9dd044fc073d --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.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.CostManagement.Models +{ + + /// + /// Defines values for TimeframeType. + /// + public static class TimeframeType + { + public const string WeekToDate = "WeekToDate"; + public const string MonthToDate = "MonthToDate"; + public const string YearToDate = "YearToDate"; + public const string Custom = "Custom"; + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs new file mode 100644 index 000000000000..af80e43c9a91 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs @@ -0,0 +1,245 @@ +// +// 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.CostManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// States and configurations of Cost Analysis. + /// + [Rest.Serialization.JsonTransformation] + public partial class View : ProxyResource + { + /// + /// Initializes a new instance of the View class. + /// + public View() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the View class. + /// + /// The time frame for pulling data for the + /// report. If custom, then a specific time period must be provided. + /// Possible values include: 'WeekToDate', 'MonthToDate', 'YearToDate', + /// 'Custom' + /// Resource Id. + /// Resource name. + /// Resource type. + /// eTag of the resource. To handle concurrent + /// update scenario, this field will be used to determine whether the + /// user is updating the latest version or not. + /// User input name of the view. + /// Required. + /// Cost Management scope to save the view on. This + /// includes 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for ExternalBillingAccount scope, and + /// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for ExternalSubscription scope. + /// Date the user created this view. + /// Date when the user last modified this + /// view. + /// Has time period for pulling data for the + /// report. + /// Has definition for data in this report + /// config. + /// Chart type of the main view in Cost Analysis. + /// Required. Possible values include: 'Area', 'Line', 'StackedColumn', + /// 'GroupedColumn', 'Table' + /// Show costs accumulated over time. + /// Possible values include: 'true', 'false' + /// Metric to use when displaying costs. Possible + /// values include: 'ActualCost', 'AmortizedCost', 'AHUB' + /// List of KPIs to show in Cost Analysis + /// UI. + /// Configuration of 3 sub-views in the Cost + /// Analysis UI. + public View(string timeframe, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string displayName = default(string), string scope = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), ReportConfigTimePeriod timePeriod = default(ReportConfigTimePeriod), ReportConfigDataset dataset = default(ReportConfigDataset), string chart = default(string), string accumulated = default(string), string metric = default(string), IList kpis = default(IList), IList pivots = default(IList)) + : base(id, name, type, eTag) + { + DisplayName = displayName; + Scope = scope; + CreatedOn = createdOn; + ModifiedOn = modifiedOn; + Timeframe = timeframe; + TimePeriod = timePeriod; + Dataset = dataset; + Chart = chart; + Accumulated = accumulated; + Metric = metric; + Kpis = kpis; + Pivots = pivots; + CustomInit(); + } + /// + /// Static constructor for View class. + /// + static View() + { + ViewType = "Usage"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user input name of the view. Required. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets cost Management scope to save the view on. This + /// includes 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' + /// for Management Group scope, + /// '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for ExternalBillingAccount scope, and + /// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for ExternalSubscription scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; set; } + + /// + /// Gets date the user created this view. + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; private set; } + + /// + /// Gets date when the user last modified this view. + /// + [JsonProperty(PropertyName = "properties.modifiedOn")] + public System.DateTime? ModifiedOn { get; private set; } + + /// + /// Gets or sets the time frame for pulling data for the report. If + /// custom, then a specific time period must be provided. Possible + /// values include: 'WeekToDate', 'MonthToDate', 'YearToDate', 'Custom' + /// + [JsonProperty(PropertyName = "properties.query.timeframe")] + public string Timeframe { get; set; } + + /// + /// Gets or sets has time period for pulling data for the report. + /// + [JsonProperty(PropertyName = "properties.query.timePeriod")] + public ReportConfigTimePeriod TimePeriod { get; set; } + + /// + /// Gets or sets has definition for data in this report config. + /// + [JsonProperty(PropertyName = "properties.query.dataset")] + public ReportConfigDataset Dataset { get; set; } + + /// + /// Gets or sets chart type of the main view in Cost Analysis. + /// Required. Possible values include: 'Area', 'Line', 'StackedColumn', + /// 'GroupedColumn', 'Table' + /// + [JsonProperty(PropertyName = "properties.chart")] + public string Chart { get; set; } + + /// + /// Gets or sets show costs accumulated over time. Possible values + /// include: 'true', 'false' + /// + [JsonProperty(PropertyName = "properties.accumulated")] + public string Accumulated { get; set; } + + /// + /// Gets or sets metric to use when displaying costs. Possible values + /// include: 'ActualCost', 'AmortizedCost', 'AHUB' + /// + [JsonProperty(PropertyName = "properties.metric")] + public string Metric { get; set; } + + /// + /// Gets or sets list of KPIs to show in Cost Analysis UI. + /// + [JsonProperty(PropertyName = "properties.kpis")] + public IList Kpis { get; set; } + + /// + /// Gets or sets configuration of 3 sub-views in the Cost Analysis UI. + /// + [JsonProperty(PropertyName = "properties.pivots")] + public IList Pivots { get; set; } + + /// + /// The type of the report. Usage represents actual usage, forecast + /// represents forecasted data and UsageAndForecast represents both + /// usage and forecasted data. Actual usage and forecasted data can be + /// differentiated based on dates. + /// + [JsonProperty(PropertyName = "properties.query.type")] + public static string ViewType { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Timeframe == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Timeframe"); + } + if (TimePeriod != null) + { + TimePeriod.Validate(); + } + if (Dataset != null) + { + Dataset.Validate(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs new file mode 100644 index 000000000000..72bbdd61c1c1 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs @@ -0,0 +1,390 @@ +// +// 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.CostManagement +{ + 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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.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("/") ? "" : "/")), "providers/Microsoft.CostManagement/operations").ToString(); + 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 of the available consumption REST API operations. + /// + /// + /// 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..033cb34492ea --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available consumption REST API operations. + /// + /// + /// 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 IOperations 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs new file mode 100644 index 000000000000..a080a4adaaa0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs @@ -0,0 +1,30 @@ + +// +// 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.CostManagement +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_CostManagementClient + { + get + { + return new Tuple[] + { + new Tuple("CostManagement", "Budget", "2019-04-01-preview"), + new Tuple("CostManagement", "Budgets", "2019-04-01-preview"), + new Tuple("CostManagement", "Operations", "2019-04-01-preview"), + new Tuple("CostManagement", "Views", "2019-04-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs new file mode 100644 index 000000000000..f13c10f809fc --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs @@ -0,0 +1,1944 @@ +// +// 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.CostManagement +{ + 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; + + /// + /// ViewsOperations operations. + /// + internal partial class ViewsOperations : IServiceOperations, IViewsOperations + { + /// + /// Initializes a new instance of the ViewsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ViewsOperations(CostManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the CostManagementClient + /// + public CostManagementClient Client { get; private set; } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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.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("/") ? "" : "/")), "providers/Microsoft.CostManagement/views").ToString(); + 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 views at the given scope. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// 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>> ListByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + 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("scope", scope); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + 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 the view by view name. + /// + /// + /// + /// View name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("viewName", viewName); + 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("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + 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; + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateWithHttpMessagesAsync(string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// View name + /// + /// + /// 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 viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("viewName", viewName); + 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("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + 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 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; + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + 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; + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// 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 DeleteByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (viewName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "viewName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("viewName", viewName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByScope", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString(); + _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); + _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName)); + 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 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 views by tenant and object. + /// + /// + /// + /// 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; + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// 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>> ListByScopeNextWithHttpMessagesAsync(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, "ListByScopeNext", 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/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs new file mode 100644 index 000000000000..6d5ef2286b39 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs @@ -0,0 +1,563 @@ +// +// 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.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ViewsOperations. + /// + public static partial class ViewsOperationsExtensions + { + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IViewsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IViewsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + public static IPage ListByScope(this IViewsOperations operations, string scope) + { + return operations.ListByScopeAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByScopeAsync(this IViewsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByScopeWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the view by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + public static View Get(this IViewsOperations operations, string viewName) + { + return operations.GetAsync(viewName).GetAwaiter().GetResult(); + } + + /// + /// Gets the view by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IViewsOperations operations, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(viewName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + public static View CreateOrUpdate(this IViewsOperations operations, string viewName, View parameters) + { + return operations.CreateOrUpdateAsync(viewName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IViewsOperations operations, string viewName, View parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(viewName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + public static void Delete(this IViewsOperations operations, string viewName) + { + operations.DeleteAsync(viewName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IViewsOperations operations, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(viewName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + public static View GetByScope(this IViewsOperations operations, string scope, string viewName) + { + return operations.GetByScopeAsync(scope, viewName).GetAwaiter().GetResult(); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task GetByScopeAsync(this IViewsOperations operations, string scope, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByScopeWithHttpMessagesAsync(scope, viewName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + public static View CreateOrUpdateByScope(this IViewsOperations operations, string scope, string viewName, View parameters) + { + return operations.CreateOrUpdateByScopeAsync(scope, viewName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create or update a view. Update operation requires latest + /// eTag to be set in the request. You may obtain the latest eTag by performing + /// a get operation. Create operation does not require eTag. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// Parameters supplied to the CreateOrUpdate View operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateByScopeAsync(this IViewsOperations operations, string scope, string viewName, View parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateByScopeWithHttpMessagesAsync(scope, viewName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + public static void DeleteByScope(this IViewsOperations operations, string scope, string viewName) + { + operations.DeleteByScopeAsync(scope, viewName).GetAwaiter().GetResult(); + } + + /// + /// The operation to delete a view. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with view operations. This includes + /// 'subscriptions/{subscriptionId}' for subscription scope, + /// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resourceGroup scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// Billing Account scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' + /// for Department scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' + /// for EnrollmentAccount scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' + /// for InvoiceSection scope, + /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for + /// Management Group scope, + /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' + /// for External Billing Account scope and + /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' + /// for External Subscription scope. + /// + /// + /// View name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByScopeAsync(this IViewsOperations operations, string scope, string viewName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteByScopeWithHttpMessagesAsync(scope, viewName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IViewsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all views by tenant and object. + /// + /// + /// + /// 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 IViewsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByScopeNext(this IViewsOperations operations, string nextPageLink) + { + return operations.ListByScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all views at the given scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByScopeNextAsync(this IViewsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} From a88658a3f5f84ad9e27aee4bc78c94b390f94a4a Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2019 06:55:41 +0000 Subject: [PATCH 4/5] [AutoPR Microsoft.Azure.Management.Subscription] [Hub Generated] Review request for Microsoft.Subscription to add version preview/2018-11-01-preview (#250) * Update swagger_to_sdk_config.json * Generated from 12cf92bb36d2c853720ea3480580c9ef415f9984 Corrected the createSubscriptionUnderBillingProfile example with correct profile name. --- .../src/Generated/ISubscriptionClient.cs | 8 +- .../ISubscriptionFactoryOperations.cs | 60 -- .../src/Generated/ISubscriptionsOperations.cs | 188 +++++ ...ModernCspSubscriptionCreationParameters.cs | 103 +++ ...bscriptionsCreateCspSubscriptionHeaders.cs | 66 ++ ...SubscriptionsCreateSubscriptionHeaders.cs} | 10 +- ...eSubscriptionUnderBillingProfileHeaders.cs | 66 ++ .../Generated/SdkInfo_SubscriptionClient.cs | 13 +- .../src/Generated/SubscriptionClient.cs | 10 +- .../SubscriptionFactoryOperations.cs | 244 ------ ...SubscriptionFactoryOperationsExtensions.cs | 100 --- .../src/Generated/SubscriptionsOperations.cs | 746 ++++++++++++++++++ .../SubscriptionsOperationsExtensions.cs | 316 ++++++++ 13 files changed, 1500 insertions(+), 430 deletions(-) create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs rename sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/{SubscriptionFactoryCreateSubscriptionHeaders.cs => SubscriptionsCreateSubscriptionHeaders.cs} (83%) create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs index 97083c595945..db13bc4ec97d 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs @@ -70,14 +70,14 @@ public partial interface ISubscriptionClient : System.IDisposable ISubscriptionOperationOperations SubscriptionOperation { get; } /// - /// Gets the ISubscriptionFactoryOperations. + /// Gets the ISubscriptionOperations. /// - ISubscriptionFactoryOperations SubscriptionFactory { get; } + ISubscriptionOperations SubscriptionOperations { get; } /// - /// Gets the ISubscriptionOperations. + /// Gets the ISubscriptionFactoryOperations. /// - ISubscriptionOperations SubscriptionOperations { get; } + ISubscriptionFactoryOperations SubscriptionFactory { get; } /// /// Gets the IOperations. diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs index a4b1ac267d9a..c0afa0489690 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs @@ -23,36 +23,6 @@ namespace Microsoft.Azure.Management.Subscription /// public partial interface ISubscriptionFactoryOperations { - /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which - /// you want to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// 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> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates an Azure subscription /// @@ -80,36 +50,6 @@ public partial interface ISubscriptionFactoryOperations /// Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for - /// which you want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which - /// you want to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Creates an Azure subscription /// /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs index ef734314a95c..d0b0d1db2c8a 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs @@ -93,6 +93,100 @@ public partial interface ISubscriptionsOperations /// Task> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new WebDirect or EA Azure subscription + /// (under billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which + /// you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> CreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all available geo-locations. /// /// @@ -161,6 +255,100 @@ public partial interface ISubscriptionsOperations /// Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new WebDirect or EA Azure subscription + /// (under billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which + /// you want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which + /// you want to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for + /// which you want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all subscriptions for a tenant. /// /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs new file mode 100644 index 000000000000..1186b398cec0 --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.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.Subscription.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters required to create a new CSP subscription. + /// + public partial class ModernCspSubscriptionCreationParameters + { + /// + /// Initializes a new instance of the + /// ModernCspSubscriptionCreationParameters class. + /// + public ModernCspSubscriptionCreationParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ModernCspSubscriptionCreationParameters class. + /// + /// The friendly name of the + /// subscription. + /// The SKU ID of the Azure plan. Azure plan + /// determines the pricing and service-level agreement of the + /// subscription. Use 001 for Microsoft Azure Plan and 002 for + /// Microsoft Azure Plan for DevTest. + /// Reseller ID, basically MPN Id. + /// Service provider ID, basically MPN + /// Id. + public ModernCspSubscriptionCreationParameters(string displayName, string skuId, string resellerId = default(string), string serviceProviderId = default(string)) + { + DisplayName = displayName; + SkuId = skuId; + ResellerId = resellerId; + ServiceProviderId = serviceProviderId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the friendly name of the subscription. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the SKU ID of the Azure plan. Azure plan determines + /// the pricing and service-level agreement of the subscription. Use + /// 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for + /// DevTest. + /// + [JsonProperty(PropertyName = "skuId")] + public string SkuId { get; set; } + + /// + /// Gets or sets reseller ID, basically MPN Id. + /// + [JsonProperty(PropertyName = "resellerId")] + public string ResellerId { get; set; } + + /// + /// Gets or sets service provider ID, basically MPN Id. + /// + [JsonProperty(PropertyName = "serviceProviderId")] + public string ServiceProviderId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (SkuId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SkuId"); + } + } + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.cs new file mode 100644 index 000000000000..812b4ae5179f --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateCspSubscriptionHeaders.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.Subscription.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateCspSubscription operation. + /// + public partial class SubscriptionsCreateCspSubscriptionHeaders + { + /// + /// Initializes a new instance of the + /// SubscriptionsCreateCspSubscriptionHeaders class. + /// + public SubscriptionsCreateCspSubscriptionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubscriptionsCreateCspSubscriptionHeaders class. + /// + /// GET this URL to retrieve the status of the + /// asynchronous operation. + /// The amount of delay to use while the + /// status of the operation is checked. The value is expressed in + /// seconds. + public SubscriptionsCreateCspSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets GET this URL to retrieve the status of the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the amount of delay to use while the status of the + /// operation is checked. The value is expressed in seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionHeaders.cs similarity index 83% rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionHeaders.cs index fa602c14e1f7..49970cd58d2a 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionHeaders.cs @@ -16,27 +16,27 @@ namespace Microsoft.Azure.Management.Subscription.Models /// /// Defines headers for CreateSubscription operation. /// - public partial class SubscriptionFactoryCreateSubscriptionHeaders + public partial class SubscriptionsCreateSubscriptionHeaders { /// /// Initializes a new instance of the - /// SubscriptionFactoryCreateSubscriptionHeaders class. + /// SubscriptionsCreateSubscriptionHeaders class. /// - public SubscriptionFactoryCreateSubscriptionHeaders() + public SubscriptionsCreateSubscriptionHeaders() { CustomInit(); } /// /// Initializes a new instance of the - /// SubscriptionFactoryCreateSubscriptionHeaders class. + /// SubscriptionsCreateSubscriptionHeaders class. /// /// GET this URL to retrieve the status of the /// asynchronous operation. /// The amount of delay to use while the /// status of the operation is checked. The value is expressed in /// seconds. - public SubscriptionFactoryCreateSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) + public SubscriptionsCreateSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.cs new file mode 100644 index 000000000000..c1cdc93a9e7d --- /dev/null +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionsCreateSubscriptionUnderBillingProfileHeaders.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.Subscription.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateSubscriptionUnderBillingProfile operation. + /// + public partial class SubscriptionsCreateSubscriptionUnderBillingProfileHeaders + { + /// + /// Initializes a new instance of the + /// SubscriptionsCreateSubscriptionUnderBillingProfileHeaders class. + /// + public SubscriptionsCreateSubscriptionUnderBillingProfileHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SubscriptionsCreateSubscriptionUnderBillingProfileHeaders class. + /// + /// GET this URL to retrieve the status of the + /// asynchronous operation. + /// The amount of delay to use while the + /// status of the operation is checked. The value is expressed in + /// seconds. + public SubscriptionsCreateSubscriptionUnderBillingProfileHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets GET this URL to retrieve the status of the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the amount of delay to use while the status of the + /// operation is checked. The value is expressed in seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs index d9fde8d12ae0..6b2e01a5db05 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs @@ -20,7 +20,7 @@ public static IEnumerable> ApiInfo_SubscriptionCli return new Tuple[] { new Tuple("Billing", "SubscriptionFactory", "2018-03-01-preview"), - new Tuple("Billing", "SubscriptionFactory", "2018-11-01-preview"), + new Tuple("Billing", "Subscriptions", "2018-11-01-preview"), new Tuple("Subscription", "Operations", "2018-03-01-preview"), new Tuple("Subscription", "SubscriptionOperation", "2018-11-01-preview"), new Tuple("Subscription", "SubscriptionOperations", "2018-03-01-preview"), @@ -30,16 +30,5 @@ public static IEnumerable> ApiInfo_SubscriptionCli }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\github2\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "ae48ce6edc05501e9b78d93d6e36862599cdedb5"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs index 5f732c5369b0..f56db1e0aa24 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs @@ -75,14 +75,14 @@ public partial class SubscriptionClient : ServiceClient, ISu public virtual ISubscriptionOperationOperations SubscriptionOperation { get; private set; } /// - /// Gets the ISubscriptionFactoryOperations. + /// Gets the ISubscriptionOperations. /// - public virtual ISubscriptionFactoryOperations SubscriptionFactory { get; private set; } + public virtual ISubscriptionOperations SubscriptionOperations { get; private set; } /// - /// Gets the ISubscriptionOperations. + /// Gets the ISubscriptionFactoryOperations. /// - public virtual ISubscriptionOperations SubscriptionOperations { get; private set; } + public virtual ISubscriptionFactoryOperations SubscriptionFactory { get; private set; } /// /// Gets the IOperations. @@ -337,8 +337,8 @@ private void Initialize() { Subscriptions = new SubscriptionsOperations(this); SubscriptionOperation = new SubscriptionOperationOperations(this); - SubscriptionFactory = new SubscriptionFactoryOperations(this); SubscriptionOperations = new SubscriptionOperations(this); + SubscriptionFactory = new SubscriptionFactoryOperations(this); Operations = new Operations(this); Tenants = new TenantsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs index 3f038282e47c..eb2d38a3a912 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs @@ -50,33 +50,6 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) /// public SubscriptionClient Client { get; private set; } - /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Creates an Azure subscription /// @@ -100,223 +73,6 @@ internal SubscriptionFactoryOperations(SubscriptionClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// The operation to create a new Azure subscription - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (invoiceSectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } - if (body != null) - { - body.Validate(); - } - string apiVersion = "2018-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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); - } - } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Creates an Azure subscription /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs index edd23ced2cf6..35565c9e7e3b 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs @@ -21,56 +21,6 @@ namespace Microsoft.Azure.Management.Subscription /// public static partial class SubscriptionFactoryOperationsExtensions { - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) - { - return operations.CreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); - } - - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The cancellation token. - /// - public static async Task CreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates an Azure subscription /// @@ -113,56 +63,6 @@ public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(t } } - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) - { - return operations.BeginCreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); - } - - /// - /// The operation to create a new Azure subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Microsoft Customer Agreement billing account for which you - /// want to create the subscription. - /// - /// - /// The name of the invoice section in the billing account for which you want - /// to create the subscription. - /// - /// - /// The subscription creation parameters. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates an Azure subscription /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs index c5b50d71fd7a..f388b676e6be 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs @@ -589,6 +589,91 @@ internal SubscriptionsOperations(SubscriptionClient client) return _result; } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Gets all available geo-locations. /// @@ -1119,6 +1204,667 @@ internal SubscriptionsOperations(SubscriptionClient client) return _result; } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscriptionUnderBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// 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> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2018-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateCspSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets all subscriptions for a tenant. /// diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs index c403fe1a5aff..3e26b468ba75 100644 --- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs +++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs @@ -131,6 +131,164 @@ public static EnabledSubscriptionId Enable(this ISubscriptionsOperations operati } } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult CreateSubscription(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.CreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CreateSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult CreateSubscriptionUnderBillingProfile(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.CreateSubscriptionUnderBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CreateSubscriptionUnderBillingProfileAsync(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult CreateCspSubscription(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + { + return operations.CreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task CreateCspSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all available geo-locations. /// @@ -237,6 +395,164 @@ public static IPage List(this ISubscriptionsOperations operat } } + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.BeginCreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult BeginCreateSubscriptionUnderBillingProfile(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body) + { + return operations.BeginCreateSubscriptionUnderBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new WebDirect or EA Azure subscription (under + /// billingProfiles). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the billing profile in the billing account for which you want + /// to create the subscription. + /// + /// + /// The name of the invoice section in the billing account for which you want + /// to create the subscription. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateSubscriptionUnderBillingProfileAsync(this ISubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateSubscriptionUnderBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + public static SubscriptionCreationResult BeginCreateCspSubscription(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body) + { + return operations.BeginCreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a new CSP subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Microsoft Customer Agreement billing account for which you + /// want to create the subscription. + /// + /// + /// The name of the customer. + /// + /// + /// The subscription creation parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateCspSubscriptionAsync(this ISubscriptionsOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all subscriptions for a tenant. /// From 979eef78c9261714e63036629a8d542f0755ffc6 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 10 Oct 2019 05:07:18 +0000 Subject: [PATCH 5/5] Generated from b90b1c367459cd32fc49a26daf13ff8f46ad79fa chore: jsonfmt frontdoor --- .../BackendPoolsOperationsExtensions.cs | 341 --- .../src/Generated/ExperimentsOperations.cs | 433 +++ .../ExperimentsOperationsExtensions.cs | 99 + .../Generated/FrontDoorManagementClient.cs | 2692 ++++++++++++++++- .../FrontDoorManagementClientExtensions.cs | 818 +++++ .../Generated/FrontendEndpointsOperations.cs | 574 ---- .../FrontendEndpointsOperationsExtensions.cs | 194 -- .../HealthProbeSettingsOperations.cs | 1255 -------- ...HealthProbeSettingsOperationsExtensions.cs | 341 --- .../src/Generated/IBackendPoolsOperations.cs | 217 -- .../src/Generated/IExperimentsOperations.cs | 74 + .../Generated/IFrontDoorManagementClient.cs | 392 ++- .../Generated/IFrontendEndpointsOperations.cs | 120 - .../IHealthProbeSettingsOperations.cs | 224 -- .../ILoadBalancingSettingsOperations.cs | 224 -- .../IPreconfiguredEndpointsOperations.cs | 74 + .../src/Generated/IProfilesOperations.cs | 114 + .../src/Generated/IRoutingRulesOperations.cs | 217 -- .../LoadBalancingSettingsOperations.cs | 1255 -------- ...adBalancingSettingsOperationsExtensions.cs | 341 --- .../Generated/ManagedRuleSetsOperations.cs | 2 +- .../Generated/Models/AggregationInterval.cs | 22 + .../Generated/Models/BackendPoolListResult.cs | 65 + .../src/Generated/Models/Endpoint.cs | 59 + .../src/Generated/Models/EndpointType.cs | 24 + .../src/Generated/Models/Experiment.cs | 119 + .../Generated/Models/ExperimentUpdateModel.cs | 76 + .../Models/HealthProbeSettingsListResult.cs | 68 + .../src/Generated/Models/LatencyMetric.cs | 131 + .../src/Generated/Models/LatencyScorecard.cs | 136 + .../LatencyScorecardAggregationInterval.cs | 23 + .../Models/LoadBalancingSettingsListResult.cs | 68 + .../Generated/Models/ManagedRuleDefinition.cs | 25 +- .../Generated/Models/ManagedRuleExclusion.cs | 102 + .../ManagedRuleExclusionMatchVariable.cs | 24 + ...nagedRuleExclusionSelectorMatchOperator.cs | 25 + .../Models/ManagedRuleGroupOverride.cs | 26 +- .../Generated/Models/ManagedRuleOverride.cs | 24 +- .../src/Generated/Models/ManagedRuleSet.cs | 26 +- .../src/Generated/Models/MatchCondition.cs | 5 +- .../src/Generated/Models/MatchVariable.cs | 1 + .../Models/NetworkExperimentResourceState.cs | 26 + .../Generated/Models/PreconfiguredEndpoint.cs | 88 + .../src/Generated/Models/Profile.cs | 85 + .../Generated/Models/ProfileUpdateModel.cs | 66 + .../Generated/Models/RoutingRuleListResult.cs | 65 + .../src/Generated/Models/State.cs | 22 + .../src/Generated/Models/Timeseries.cs | 123 + .../Models/TimeseriesAggregationInterval.cs | 22 + .../Generated/Models/TimeseriesDataPoint.cs | 60 + .../src/Generated/Models/TimeseriesType.cs | 24 + .../src/Generated/PoliciesOperations.cs | 8 +- .../PreconfiguredEndpointsOperations.cs | 433 +++ ...configuredEndpointsOperationsExtensions.cs | 99 + ...olsOperations.cs => ProfilesOperations.cs} | 577 +--- .../Generated/ProfilesOperationsExtensions.cs | 159 + .../src/Generated/RoutingRulesOperations.cs | 1255 -------- .../RoutingRulesOperationsExtensions.cs | 341 --- .../SdkInfo_FrontDoorManagementClient.cs | 32 +- 59 files changed, 6993 insertions(+), 7542 deletions(-) delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperationsExtensions.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperations.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperationsExtensions.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperationsExtensions.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IBackendPoolsOperations.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IExperimentsOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IHealthProbeSettingsOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ILoadBalancingSettingsOperations.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IPreconfiguredEndpointsOperations.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IProfilesOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IRoutingRulesOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperationsExtensions.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/AggregationInterval.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/BackendPoolListResult.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Endpoint.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/EndpointType.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Experiment.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ExperimentUpdateModel.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/HealthProbeSettingsListResult.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyMetric.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecard.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecardAggregationInterval.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LoadBalancingSettingsListResult.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusion.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionMatchVariable.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionSelectorMatchOperator.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/NetworkExperimentResourceState.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/PreconfiguredEndpoint.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Profile.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ProfileUpdateModel.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/RoutingRuleListResult.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/State.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Timeseries.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesAggregationInterval.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesDataPoint.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesType.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperations.cs create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperationsExtensions.cs rename sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/{BackendPoolsOperations.cs => ProfilesOperations.cs} (52%) create mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperationsExtensions.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperations.cs delete mode 100644 sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperationsExtensions.cs diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperationsExtensions.cs deleted file mode 100644 index 0fffad0a5e17..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperationsExtensions.cs +++ /dev/null @@ -1,341 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for BackendPoolsOperations. - /// - public static partial class BackendPoolsOperationsExtensions - { - /// - /// Lists all of the Backend Pools within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - public static IPage ListByFrontDoor(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName) - { - return operations.ListByFrontDoorAsync(resourceGroupName, frontDoorName).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the Backend Pools within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorAsync(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorWithHttpMessagesAsync(resourceGroupName, frontDoorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a Backend Pool with the specified Pool name within the specified Front - /// Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - public static BackendPool Get(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName) - { - return operations.GetAsync(resourceGroupName, frontDoorName, backendPoolName).GetAwaiter().GetResult(); - } - - /// - /// Gets a Backend Pool with the specified Pool name within the specified Front - /// Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - public static BackendPool CreateOrUpdate(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, BackendPool backendPoolParameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, BackendPool backendPoolParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - public static void Delete(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName) - { - operations.DeleteAsync(resourceGroupName, frontDoorName, backendPoolName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - public static BackendPool BeginCreateOrUpdate(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, BackendPool backendPoolParameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, BackendPool backendPoolParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - public static void BeginDelete(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName) - { - operations.BeginDeleteAsync(resourceGroupName, frontDoorName, backendPoolName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IBackendPoolsOperations operations, string resourceGroupName, string frontDoorName, string backendPoolName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists all of the Backend Pools within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByFrontDoorNext(this IBackendPoolsOperations operations, string nextPageLink) - { - return operations.ListByFrontDoorNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the Backend Pools within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorNextAsync(this IBackendPoolsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperations.cs new file mode 100644 index 000000000000..8ddfa4bea84c --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperations.cs @@ -0,0 +1,433 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExperimentsOperations operations. + /// + internal partial class ExperimentsOperations : IServiceOperations, IExperimentsOperations + { + /// + /// Initializes a new instance of the ExperimentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExperimentsOperations(FrontDoorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the FrontDoorManagementClient + /// + public FrontDoorManagementClient Client { get; private set; } + + /// + /// Gets a list of Experiments + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// 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>> ListByProfileWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of Experiments + /// + /// + /// 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>> ListByProfileNextWithHttpMessagesAsync(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, "ListByProfileNext", 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperationsExtensions.cs new file mode 100644 index 000000000000..f2826fe40555 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ExperimentsOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExperimentsOperations. + /// + public static partial class ExperimentsOperationsExtensions + { + /// + /// Gets a list of Experiments + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + public static IPage ListByProfile(this IExperimentsOperations operations, string resourceGroupName, string profileName) + { + return operations.ListByProfileAsync(resourceGroupName, profileName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Experiments + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The cancellation token. + /// + public static async Task> ListByProfileAsync(this IExperimentsOperations operations, string resourceGroupName, string profileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByProfileWithHttpMessagesAsync(resourceGroupName, profileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Experiments + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByProfileNext(this IExperimentsOperations operations, string nextPageLink) + { + return operations.ListByProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Experiments + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByProfileNextAsync(this IExperimentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClient.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClient.cs index 89ee16d4a0c3..70a99b786a4d 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClient.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClient.cs @@ -74,29 +74,24 @@ public partial class FrontDoorManagementClient : ServiceClient - /// Gets the IFrontDoorsOperations. - /// - public virtual IFrontDoorsOperations FrontDoors { get; private set; } - - /// - /// Gets the IRoutingRulesOperations. + /// Gets the IProfilesOperations. /// - public virtual IRoutingRulesOperations RoutingRules { get; private set; } + public virtual IProfilesOperations Profiles { get; private set; } /// - /// Gets the IHealthProbeSettingsOperations. + /// Gets the IPreconfiguredEndpointsOperations. /// - public virtual IHealthProbeSettingsOperations HealthProbeSettings { get; private set; } + public virtual IPreconfiguredEndpointsOperations PreconfiguredEndpoints { get; private set; } /// - /// Gets the ILoadBalancingSettingsOperations. + /// Gets the IExperimentsOperations. /// - public virtual ILoadBalancingSettingsOperations LoadBalancingSettings { get; private set; } + public virtual IExperimentsOperations Experiments { get; private set; } /// - /// Gets the IBackendPoolsOperations. + /// Gets the IFrontDoorsOperations. /// - public virtual IBackendPoolsOperations BackendPools { get; private set; } + public virtual IFrontDoorsOperations FrontDoors { get; private set; } /// /// Gets the IFrontendEndpointsOperations. @@ -359,11 +354,10 @@ public FrontDoorManagementClient(System.Uri baseUri, ServiceClientCredentials cr /// private void Initialize() { + Profiles = new ProfilesOperations(this); + PreconfiguredEndpoints = new PreconfiguredEndpointsOperations(this); + Experiments = new ExperimentsOperations(this); FrontDoors = new FrontDoorsOperations(this); - RoutingRules = new RoutingRulesOperations(this); - HealthProbeSettings = new HealthProbeSettingsOperations(this); - LoadBalancingSettings = new LoadBalancingSettingsOperations(this); - BackendPools = new BackendPoolsOperations(this); FrontendEndpoints = new FrontendEndpointsOperations(this); Endpoints = new EndpointsOperations(this); Policies = new PoliciesOperations(this); @@ -405,10 +399,13 @@ private void Initialize() DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } /// - /// Check the availability of a Front Door resource name. + /// Gets an NetworkExperiment Profile by ProfileName /// - /// - /// Input to check. + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner /// /// /// Headers that will be added to request. @@ -431,17 +428,43 @@ private void Initialize() /// /// A response object containing the response body and response headers. /// - public async Task> CheckFrontDoorNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityInput checkFrontDoorNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetNetworkExperimentProfilesByProfileNameWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (checkFrontDoorNameAvailabilityInput == null) + if (SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "checkFrontDoorNameAvailabilityInput"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); } - if (checkFrontDoorNameAvailabilityInput != null) + if (resourceGroupName == null) { - checkFrontDoorNameAvailabilityInput.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2019-05-01"; + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + string apiVersion = "2019-11-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -449,14 +472,18 @@ private void Initialize() { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("checkFrontDoorNameAvailabilityInput", checkFrontDoorNameAvailabilityInput); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CheckFrontDoorNameAvailability", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetNetworkExperimentProfilesByProfileName", tracingParameters); } // Construct URL var _baseUrl = BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Network/checkFrontDoorNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); List _queryParameters = new List(); if (apiVersion != null) { @@ -469,7 +496,7 @@ private void Initialize() // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (GenerateClientRequestId != null && GenerateClientRequestId.Value) @@ -500,12 +527,6 @@ private void Initialize() // Serialize Request string _requestContent = null; - if(checkFrontDoorNameAvailabilityInput != null) - { - _requestContent = SafeJsonConvert.SerializeObject(checkFrontDoorNameAvailabilityInput, 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 (Credentials != null) { @@ -556,7 +577,7 @@ private void Initialize() throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -569,7 +590,7 @@ private void Initialize() _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); } catch (JsonException ex) { @@ -589,10 +610,91 @@ private void Initialize() } /// - /// Check the availability of a Front Door subdomain. + /// Creates an NetworkExperiment Profile /// - /// - /// Input to check. + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(string profileName, string resourceGroupName, Profile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(profileName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(string resourceGroupName, string profileName, ProfileUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(resourceGroupName, profileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteNetworkExperimentProfilesWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteNetworkExperimentProfilesWithHttpMessagesAsync(resourceGroupName, profileName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an Experiment by ExperimentName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment /// /// /// Headers that will be added to request. @@ -615,21 +717,54 @@ private void Initialize() /// /// A response object containing the response body and response headers. /// - public async Task> CheckFrontDoorNameAvailabilityWithSubscriptionWithHttpMessagesAsync(CheckNameAvailabilityInput checkFrontDoorNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetExperimentsByExperimentNameWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (checkFrontDoorNameAvailabilityInput == null) + if (SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "checkFrontDoorNameAvailabilityInput"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); } - if (checkFrontDoorNameAvailabilityInput != null) + if (resourceGroupName == null) { - checkFrontDoorNameAvailabilityInput.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (SubscriptionId == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + 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_\\-\\(\\)\\.]*[^\\.]$"); + } } - string apiVersion = "2019-05-01"; + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (experimentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "experimentName"); + } + if (experimentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(experimentName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "experimentName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + string apiVersion = "2019-11-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -637,15 +772,20 @@ private void Initialize() { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("checkFrontDoorNameAvailabilityInput", checkFrontDoorNameAvailabilityInput); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("experimentName", experimentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CheckFrontDoorNameAvailabilityWithSubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetExperimentsByExperimentName", tracingParameters); } // Construct URL var _baseUrl = BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{experimentName}", System.Uri.EscapeDataString(experimentName)); List _queryParameters = new List(); if (apiVersion != null) { @@ -658,7 +798,7 @@ private void Initialize() // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (GenerateClientRequestId != null && GenerateClientRequestId.Value) @@ -689,12 +829,6 @@ private void Initialize() // Serialize Request string _requestContent = null; - if(checkFrontDoorNameAvailabilityInput != null) - { - _requestContent = SafeJsonConvert.SerializeObject(checkFrontDoorNameAvailabilityInput, 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 (Credentials != null) { @@ -745,7 +879,7 @@ private void Initialize() throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -758,7 +892,7 @@ private void Initialize() _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); } catch (JsonException ex) { @@ -777,5 +911,2441 @@ private void Initialize() return _result; } + /// + /// Creates or updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Experiment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateExperimentsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateExperimentsByExperimentNameWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateExperimentsByExperimentNameWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteExperimentsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Latency Scorecard for a given Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The aggregation interval of the Latency Scorecard. Possible values include: + /// 'Daily', 'Weekly', 'Monthly' + /// + /// + /// The end DateTime of the Latency Scorecard in UTC + /// + /// + /// The country associated with the Latency Scorecard. Values are country ISO + /// codes as specified here- https://www.iso.org/iso-3166-country-codes.html + /// + /// + /// 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> GetLatencyScorecardsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, string aggregationInterval, string endDateTimeUTC = default(string), string country = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (experimentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "experimentName"); + } + if (experimentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(experimentName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "experimentName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (aggregationInterval == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aggregationInterval"); + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("experimentName", experimentName); + tracingParameters.Add("endDateTimeUTC", endDateTimeUTC); + tracingParameters.Add("country", country); + tracingParameters.Add("aggregationInterval", aggregationInterval); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLatencyScorecards", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/LatencyScorecard").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{experimentName}", System.Uri.EscapeDataString(experimentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (endDateTimeUTC != null) + { + _queryParameters.Add(string.Format("endDateTimeUTC={0}", System.Uri.EscapeDataString(endDateTimeUTC))); + } + if (country != null) + { + _queryParameters.Add(string.Format("country={0}", System.Uri.EscapeDataString(country))); + } + if (aggregationInterval != null) + { + _queryParameters.Add(string.Format("aggregationInterval={0}", System.Uri.EscapeDataString(aggregationInterval))); + } + 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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 a Timeseries for a given Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The start DateTime of the Timeseries in UTC + /// + /// + /// The end DateTime of the Timeseries in UTC + /// + /// + /// The aggregation interval of the Timeseries. Possible values include: + /// 'Hourly', 'Daily' + /// + /// + /// The type of Timeseries. Possible values include: 'MeasurementCounts', + /// 'LatencyP50', 'LatencyP75', 'LatencyP95' + /// + /// + /// The specific endpoint + /// + /// + /// The country associated with the Timeseries. Values are country ISO codes as + /// specified here- https://www.iso.org/iso-3166-country-codes.html + /// + /// + /// 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> GetTimeseriesWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, System.DateTime startDateTimeUTC, System.DateTime endDateTimeUTC, string aggregationInterval, string timeseriesType, string endpoint = default(string), string country = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (experimentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "experimentName"); + } + if (experimentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(experimentName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "experimentName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (aggregationInterval == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aggregationInterval"); + } + if (timeseriesType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "timeseriesType"); + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("experimentName", experimentName); + tracingParameters.Add("startDateTimeUTC", startDateTimeUTC); + tracingParameters.Add("endDateTimeUTC", endDateTimeUTC); + tracingParameters.Add("aggregationInterval", aggregationInterval); + tracingParameters.Add("timeseriesType", timeseriesType); + tracingParameters.Add("endpoint", endpoint); + tracingParameters.Add("country", country); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimeseries", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}/Timeseries").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{experimentName}", System.Uri.EscapeDataString(experimentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + _queryParameters.Add(string.Format("startDateTimeUTC={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(startDateTimeUTC, SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("endDateTimeUTC={0}", System.Uri.EscapeDataString(SafeJsonConvert.SerializeObject(endDateTimeUTC, SerializationSettings).Trim('"')))); + if (aggregationInterval != null) + { + _queryParameters.Add(string.Format("aggregationInterval={0}", System.Uri.EscapeDataString(aggregationInterval))); + } + if (timeseriesType != null) + { + _queryParameters.Add(string.Format("timeseriesType={0}", System.Uri.EscapeDataString(timeseriesType))); + } + if (endpoint != null) + { + _queryParameters.Add(string.Format("endpoint={0}", System.Uri.EscapeDataString(endpoint))); + } + if (country != null) + { + _queryParameters.Add(string.Format("country={0}", System.Uri.EscapeDataString(country))); + } + 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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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; + } + + /// + /// Check the availability of a Front Door resource name. + /// + /// + /// Input to check. + /// + /// + /// 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> CheckFrontDoorNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityInput checkFrontDoorNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (checkFrontDoorNameAvailabilityInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "checkFrontDoorNameAvailabilityInput"); + } + if (checkFrontDoorNameAvailabilityInput != null) + { + checkFrontDoorNameAvailabilityInput.Validate(); + } + string apiVersion = "2019-05-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("checkFrontDoorNameAvailabilityInput", checkFrontDoorNameAvailabilityInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckFrontDoorNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Network/checkFrontDoorNameAvailability").ToString(); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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(checkFrontDoorNameAvailabilityInput != null) + { + _requestContent = SafeJsonConvert.SerializeObject(checkFrontDoorNameAvailabilityInput, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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; + } + + /// + /// Check the availability of a Front Door subdomain. + /// + /// + /// Input to check. + /// + /// + /// 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> CheckFrontDoorNameAvailabilityWithSubscriptionWithHttpMessagesAsync(CheckNameAvailabilityInput checkFrontDoorNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (checkFrontDoorNameAvailabilityInput == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "checkFrontDoorNameAvailabilityInput"); + } + if (checkFrontDoorNameAvailabilityInput != null) + { + checkFrontDoorNameAvailabilityInput.Validate(); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + string apiVersion = "2019-05-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("checkFrontDoorNameAvailabilityInput", checkFrontDoorNameAvailabilityInput); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckFrontDoorNameAvailabilityWithSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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(checkFrontDoorNameAvailabilityInput != null) + { + _requestContent = SafeJsonConvert.SerializeObject(checkFrontDoorNameAvailabilityInput, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 an NetworkExperiment Profile + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + /// + /// 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> BeginCreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(string profileName, string resourceGroupName, Profile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateNetworkExperimentProfiles", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}").ToString(); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 NetworkExperimentProfiles by NetworkExperimentProfile name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + /// + /// 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> BeginUpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(string resourceGroupName, string profileName, ProfileUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateNetworkExperimentProfilesByProfilesName", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 NetworkExperiment Profile by ProfileName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// 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 BeginDeleteNetworkExperimentProfilesWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteNetworkExperimentProfiles", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, 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; + } + + /// + /// Creates or updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + /// + /// 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> BeginCreateOrUpdateExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Experiment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (experimentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "experimentName"); + } + if (experimentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(experimentName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "experimentName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("experimentName", experimentName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateExperiments", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{experimentName}", System.Uri.EscapeDataString(experimentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + /// + /// 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> BeginUpdateExperimentsByExperimentNameWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (experimentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "experimentName"); + } + if (experimentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(experimentName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "experimentName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("experimentName", experimentName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateExperimentsByExperimentName", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{experimentName}", System.Uri.EscapeDataString(experimentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// 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 BeginDeleteExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + 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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + if (experimentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "experimentName"); + } + if (experimentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(experimentName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "experimentName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("experimentName", experimentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteExperiments", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + _url = _url.Replace("{experimentName}", System.Uri.EscapeDataString(experimentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, 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; + } + } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClientExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClientExtensions.cs index a1f19b5ecc2a..df115142871d 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClientExtensions.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontDoorManagementClientExtensions.cs @@ -21,6 +21,536 @@ namespace Microsoft.Azure.Management.FrontDoor /// public static partial class FrontDoorManagementClientExtensions { + /// + /// Gets an NetworkExperiment Profile by ProfileName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + public static Profile GetNetworkExperimentProfilesByProfileName(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName) + { + return operations.GetNetworkExperimentProfilesByProfileNameAsync(resourceGroupName, profileName).GetAwaiter().GetResult(); + } + + /// + /// Gets an NetworkExperiment Profile by ProfileName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The cancellation token. + /// + public static async Task GetNetworkExperimentProfilesByProfileNameAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetNetworkExperimentProfilesByProfileNameWithHttpMessagesAsync(resourceGroupName, profileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an NetworkExperiment Profile + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + public static Profile CreateOrUpdateNetworkExperimentProfiles(this IFrontDoorManagementClient operations, string profileName, string resourceGroupName, Profile parameters) + { + return operations.CreateOrUpdateNetworkExperimentProfilesAsync(profileName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an NetworkExperiment Profile + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateNetworkExperimentProfilesAsync(this IFrontDoorManagementClient operations, string profileName, string resourceGroupName, Profile parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(profileName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + public static Profile UpdateNetworkExperimentProfilesByProfilesName(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, ProfileUpdateModel parameters) + { + return operations.UpdateNetworkExperimentProfilesByProfilesNameAsync(resourceGroupName, profileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + /// + /// The cancellation token. + /// + public static async Task UpdateNetworkExperimentProfilesByProfilesNameAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, ProfileUpdateModel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(resourceGroupName, profileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + public static void DeleteNetworkExperimentProfiles(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName) + { + operations.DeleteNetworkExperimentProfilesAsync(resourceGroupName, profileName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The cancellation token. + /// + public static async Task DeleteNetworkExperimentProfilesAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteNetworkExperimentProfilesWithHttpMessagesAsync(resourceGroupName, profileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets an Experiment by ExperimentName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + public static Experiment GetExperimentsByExperimentName(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName) + { + return operations.GetExperimentsByExperimentNameAsync(resourceGroupName, profileName, experimentName).GetAwaiter().GetResult(); + } + + /// + /// Gets an Experiment by ExperimentName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The cancellation token. + /// + public static async Task GetExperimentsByExperimentNameAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetExperimentsByExperimentNameWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + public static Experiment CreateOrUpdateExperiments(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, Experiment parameters) + { + return operations.CreateOrUpdateExperimentsAsync(resourceGroupName, profileName, experimentName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateExperimentsAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, Experiment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateExperimentsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + public static Experiment UpdateExperimentsByExperimentName(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters) + { + return operations.UpdateExperimentsByExperimentNameAsync(resourceGroupName, profileName, experimentName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + /// + /// The cancellation token. + /// + public static async Task UpdateExperimentsByExperimentNameAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateExperimentsByExperimentNameWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + public static void DeleteExperiments(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName) + { + operations.DeleteExperimentsAsync(resourceGroupName, profileName, experimentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The cancellation token. + /// + public static async Task DeleteExperimentsAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteExperimentsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a Latency Scorecard for a given Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The aggregation interval of the Latency Scorecard. Possible values include: + /// 'Daily', 'Weekly', 'Monthly' + /// + /// + /// The end DateTime of the Latency Scorecard in UTC + /// + /// + /// The country associated with the Latency Scorecard. Values are country ISO + /// codes as specified here- https://www.iso.org/iso-3166-country-codes.html + /// + public static LatencyScorecard GetLatencyScorecards(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, string aggregationInterval, string endDateTimeUTC = default(string), string country = default(string)) + { + return operations.GetLatencyScorecardsAsync(resourceGroupName, profileName, experimentName, aggregationInterval, endDateTimeUTC, country).GetAwaiter().GetResult(); + } + + /// + /// Gets a Latency Scorecard for a given Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The aggregation interval of the Latency Scorecard. Possible values include: + /// 'Daily', 'Weekly', 'Monthly' + /// + /// + /// The end DateTime of the Latency Scorecard in UTC + /// + /// + /// The country associated with the Latency Scorecard. Values are country ISO + /// codes as specified here- https://www.iso.org/iso-3166-country-codes.html + /// + /// + /// The cancellation token. + /// + public static async Task GetLatencyScorecardsAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, string aggregationInterval, string endDateTimeUTC = default(string), string country = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLatencyScorecardsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, aggregationInterval, endDateTimeUTC, country, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Timeseries for a given Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The start DateTime of the Timeseries in UTC + /// + /// + /// The end DateTime of the Timeseries in UTC + /// + /// + /// The aggregation interval of the Timeseries. Possible values include: + /// 'Hourly', 'Daily' + /// + /// + /// The type of Timeseries. Possible values include: 'MeasurementCounts', + /// 'LatencyP50', 'LatencyP75', 'LatencyP95' + /// + /// + /// The specific endpoint + /// + /// + /// The country associated with the Timeseries. Values are country ISO codes as + /// specified here- https://www.iso.org/iso-3166-country-codes.html + /// + public static Timeseries GetTimeseries(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, System.DateTime startDateTimeUTC, System.DateTime endDateTimeUTC, string aggregationInterval, string timeseriesType, string endpoint = default(string), string country = default(string)) + { + return operations.GetTimeseriesAsync(resourceGroupName, profileName, experimentName, startDateTimeUTC, endDateTimeUTC, aggregationInterval, timeseriesType, endpoint, country).GetAwaiter().GetResult(); + } + + /// + /// Gets a Timeseries for a given Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The start DateTime of the Timeseries in UTC + /// + /// + /// The end DateTime of the Timeseries in UTC + /// + /// + /// The aggregation interval of the Timeseries. Possible values include: + /// 'Hourly', 'Daily' + /// + /// + /// The type of Timeseries. Possible values include: 'MeasurementCounts', + /// 'LatencyP50', 'LatencyP75', 'LatencyP95' + /// + /// + /// The specific endpoint + /// + /// + /// The country associated with the Timeseries. Values are country ISO codes as + /// specified here- https://www.iso.org/iso-3166-country-codes.html + /// + /// + /// The cancellation token. + /// + public static async Task GetTimeseriesAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, System.DateTime startDateTimeUTC, System.DateTime endDateTimeUTC, string aggregationInterval, string timeseriesType, string endpoint = default(string), string country = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimeseriesWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, startDateTimeUTC, endDateTimeUTC, aggregationInterval, timeseriesType, endpoint, country, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Check the availability of a Front Door resource name. /// @@ -89,5 +619,293 @@ public static CheckNameAvailabilityOutput CheckFrontDoorNameAvailabilityWithSubs } } + /// + /// Creates an NetworkExperiment Profile + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + public static Profile BeginCreateOrUpdateNetworkExperimentProfiles(this IFrontDoorManagementClient operations, string profileName, string resourceGroupName, Profile parameters) + { + return operations.BeginCreateOrUpdateNetworkExperimentProfilesAsync(profileName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an NetworkExperiment Profile + /// + /// + /// The operations group for this extension method. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateNetworkExperimentProfilesAsync(this IFrontDoorManagementClient operations, string profileName, string resourceGroupName, Profile parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(profileName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + public static Profile BeginUpdateNetworkExperimentProfilesByProfilesName(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, ProfileUpdateModel parameters) + { + return operations.BeginUpdateNetworkExperimentProfilesByProfilesNameAsync(resourceGroupName, profileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateNetworkExperimentProfilesByProfilesNameAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, ProfileUpdateModel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(resourceGroupName, profileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + public static void BeginDeleteNetworkExperimentProfiles(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName) + { + operations.BeginDeleteNetworkExperimentProfilesAsync(resourceGroupName, profileName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteNetworkExperimentProfilesAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteNetworkExperimentProfilesWithHttpMessagesAsync(resourceGroupName, profileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + public static Experiment BeginCreateOrUpdateExperiments(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, Experiment parameters) + { + return operations.BeginCreateOrUpdateExperimentsAsync(resourceGroupName, profileName, experimentName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateExperimentsAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, Experiment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateExperimentsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + public static Experiment BeginUpdateExperimentsByExperimentName(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters) + { + return operations.BeginUpdateExperimentsByExperimentNameAsync(resourceGroupName, profileName, experimentName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateExperimentsByExperimentNameAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateExperimentsByExperimentNameWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + public static void BeginDeleteExperiments(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName) + { + operations.BeginDeleteExperimentsAsync(resourceGroupName, profileName, experimentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Experiment + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteExperimentsAsync(this IFrontDoorManagementClient operations, string resourceGroupName, string profileName, string experimentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteExperimentsWithHttpMessagesAsync(resourceGroupName, profileName, experimentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperations.cs index 8b1570eba458..2b83d9a00ca5 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperations.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperations.cs @@ -513,60 +513,6 @@ internal FrontendEndpointsOperations(FrontDoorManagementClient client) return _result; } - /// - /// Creates a new frontend endpoint with the specified host name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// Frontend endpoint properties needed to create a new endpoint. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes an existing frontend endpoint with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Enables a frontendEndpoint for HTTPS traffic /// @@ -620,526 +566,6 @@ internal FrontendEndpointsOperations(FrontDoorManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Creates a new frontend endpoint with the specified host name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// Frontend endpoint properties needed to create a new 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (frontendEndpointName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontendEndpointName"); - } - if (frontendEndpointName != null) - { - if (frontendEndpointName.Length > 255) - { - throw new ValidationException(ValidationRules.MaxLength, "frontendEndpointName", 255); - } - if (frontendEndpointName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "frontendEndpointName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontendEndpointName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontendEndpointName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - if (frontendEndpointParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontendEndpointParameters"); - } - if (frontendEndpointParameters != null) - { - frontendEndpointParameters.Validate(); - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("frontendEndpointName", frontendEndpointName); - tracingParameters.Add("frontendEndpointParameters", frontendEndpointParameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{frontendEndpointName}", System.Uri.EscapeDataString(frontendEndpointName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(frontendEndpointParameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(frontendEndpointParameters, 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; - } - - /// - /// Deletes an existing frontend endpoint with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string frontendEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (frontendEndpointName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontendEndpointName"); - } - if (frontendEndpointName != null) - { - if (frontendEndpointName.Length > 255) - { - throw new ValidationException(ValidationRules.MaxLength, "frontendEndpointName", 255); - } - if (frontendEndpointName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "frontendEndpointName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontendEndpointName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontendEndpointName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("frontendEndpointName", frontendEndpointName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{frontendEndpointName}", System.Uri.EscapeDataString(frontendEndpointName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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; - } - /// /// Enables a frontendEndpoint for HTTPS traffic /// diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperationsExtensions.cs index a9c27ec14fd3..1056b4320b73 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperationsExtensions.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/FrontendEndpointsOperationsExtensions.cs @@ -109,103 +109,6 @@ public static FrontendEndpoint Get(this IFrontendEndpointsOperations operations, } } - /// - /// Creates a new frontend endpoint with the specified host name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// Frontend endpoint properties needed to create a new endpoint. - /// - public static FrontendEndpoint CreateOrUpdate(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new frontend endpoint with the specified host name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// Frontend endpoint properties needed to create a new endpoint. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing frontend endpoint with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - public static void Delete(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName) - { - operations.DeleteAsync(resourceGroupName, frontDoorName, frontendEndpointName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing frontend endpoint with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Enables a frontendEndpoint for HTTPS traffic /// @@ -298,103 +201,6 @@ public static void DisableHttps(this IFrontendEndpointsOperations operations, st (await operations.DisableHttpsWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Creates a new frontend endpoint with the specified host name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// Frontend endpoint properties needed to create a new endpoint. - /// - public static FrontendEndpoint BeginCreateOrUpdate(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new frontend endpoint with the specified host name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// Frontend endpoint properties needed to create a new endpoint. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, frontendEndpointParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing frontend endpoint with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - public static void BeginDelete(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName) - { - operations.BeginDeleteAsync(resourceGroupName, frontDoorName, frontendEndpointName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing frontend endpoint with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IFrontendEndpointsOperations operations, string resourceGroupName, string frontDoorName, string frontendEndpointName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, frontendEndpointName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Enables a frontendEndpoint for HTTPS traffic /// diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperations.cs deleted file mode 100644 index 30c437cd0c90..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperations.cs +++ /dev/null @@ -1,1255 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - 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; - - /// - /// HealthProbeSettingsOperations operations. - /// - internal partial class HealthProbeSettingsOperations : IServiceOperations, IHealthProbeSettingsOperations - { - /// - /// Initializes a new instance of the HealthProbeSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal HealthProbeSettingsOperations(FrontDoorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the FrontDoorManagementClient - /// - public FrontDoorManagementClient Client { get; private set; } - - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByFrontDoor", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (healthProbeSettingsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "healthProbeSettingsName"); - } - if (healthProbeSettingsName != null) - { - if (healthProbeSettingsName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "healthProbeSettingsName", 90); - } - if (healthProbeSettingsName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "healthProbeSettingsName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(healthProbeSettingsName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "healthProbeSettingsName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("healthProbeSettingsName", healthProbeSettingsName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings/{healthProbeSettingsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{healthProbeSettingsName}", System.Uri.EscapeDataString(healthProbeSettingsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates a new HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes an existing HealthProbeSettings with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string healthProbeSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates a new HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (healthProbeSettingsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "healthProbeSettingsName"); - } - if (healthProbeSettingsName != null) - { - if (healthProbeSettingsName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "healthProbeSettingsName", 90); - } - if (healthProbeSettingsName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "healthProbeSettingsName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(healthProbeSettingsName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "healthProbeSettingsName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - if (healthProbeSettingsParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "healthProbeSettingsParameters"); - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("healthProbeSettingsName", healthProbeSettingsName); - tracingParameters.Add("healthProbeSettingsParameters", healthProbeSettingsParameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings/{healthProbeSettingsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{healthProbeSettingsName}", System.Uri.EscapeDataString(healthProbeSettingsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(healthProbeSettingsParameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(healthProbeSettingsParameters, 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; - } - - /// - /// Deletes an existing HealthProbeSettings with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (healthProbeSettingsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "healthProbeSettingsName"); - } - if (healthProbeSettingsName != null) - { - if (healthProbeSettingsName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "healthProbeSettingsName", 90); - } - if (healthProbeSettingsName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "healthProbeSettingsName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(healthProbeSettingsName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "healthProbeSettingsName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("healthProbeSettingsName", healthProbeSettingsName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/healthProbeSettings/{healthProbeSettingsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{healthProbeSettingsName}", System.Uri.EscapeDataString(healthProbeSettingsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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 HealthProbeSettings within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(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, "ListByFrontDoorNext", 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperationsExtensions.cs deleted file mode 100644 index b31018a44ccb..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/HealthProbeSettingsOperationsExtensions.cs +++ /dev/null @@ -1,341 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for HealthProbeSettingsOperations. - /// - public static partial class HealthProbeSettingsOperationsExtensions - { - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - public static IPage ListByFrontDoor(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName) - { - return operations.ListByFrontDoorAsync(resourceGroupName, frontDoorName).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorAsync(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorWithHttpMessagesAsync(resourceGroupName, frontDoorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - public static HealthProbeSettingsModel Get(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName) - { - return operations.GetAsync(resourceGroupName, frontDoorName, healthProbeSettingsName).GetAwaiter().GetResult(); - } - - /// - /// Gets a HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates a new HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - public static HealthProbeSettingsModel CreateOrUpdate(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing HealthProbeSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - public static void Delete(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName) - { - operations.DeleteAsync(resourceGroupName, frontDoorName, healthProbeSettingsName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing HealthProbeSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Creates a new HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - public static HealthProbeSettingsModel BeginCreateOrUpdate(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, healthProbeSettingsParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing HealthProbeSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - public static void BeginDelete(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName) - { - operations.BeginDeleteAsync(resourceGroupName, frontDoorName, healthProbeSettingsName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing HealthProbeSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IHealthProbeSettingsOperations operations, string resourceGroupName, string frontDoorName, string healthProbeSettingsName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, healthProbeSettingsName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByFrontDoorNext(this IHealthProbeSettingsOperations operations, string nextPageLink) - { - return operations.ListByFrontDoorNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorNextAsync(this IHealthProbeSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IBackendPoolsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IBackendPoolsOperations.cs deleted file mode 100644 index 2e842abc28a1..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IBackendPoolsOperations.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// BackendPoolsOperations operations. - /// - public partial interface IBackendPoolsOperations - { - /// - /// Lists all of the Backend Pools within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string backendPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - /// - /// 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 frontDoorName, string backendPoolName, BackendPool backendPoolParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string backendPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - /// - /// 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 frontDoorName, string backendPoolName, BackendPool backendPoolParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string backendPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all of the Backend Pools within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IExperimentsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IExperimentsOperations.cs new file mode 100644 index 000000000000..c9e987ada0a3 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IExperimentsOperations.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExperimentsOperations operations. + /// + public partial interface IExperimentsOperations + { + /// + /// Gets a list of Experiments + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// 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>> ListByProfileWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Experiments + /// + /// + /// 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>> ListByProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontDoorManagementClient.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontDoorManagementClient.cs index 7056083a2841..6c7efc39fdc6 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontDoorManagementClient.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontDoorManagementClient.cs @@ -71,29 +71,24 @@ public partial interface IFrontDoorManagementClient : System.IDisposable /// - /// Gets the IFrontDoorsOperations. + /// Gets the IProfilesOperations. /// - IFrontDoorsOperations FrontDoors { get; } + IProfilesOperations Profiles { get; } /// - /// Gets the IRoutingRulesOperations. + /// Gets the IPreconfiguredEndpointsOperations. /// - IRoutingRulesOperations RoutingRules { get; } + IPreconfiguredEndpointsOperations PreconfiguredEndpoints { get; } /// - /// Gets the IHealthProbeSettingsOperations. + /// Gets the IExperimentsOperations. /// - IHealthProbeSettingsOperations HealthProbeSettings { get; } + IExperimentsOperations Experiments { get; } /// - /// Gets the ILoadBalancingSettingsOperations. - /// - ILoadBalancingSettingsOperations LoadBalancingSettings { get; } - - /// - /// Gets the IBackendPoolsOperations. + /// Gets the IFrontDoorsOperations. /// - IBackendPoolsOperations BackendPools { get; } + IFrontDoorsOperations FrontDoors { get; } /// /// Gets the IFrontendEndpointsOperations. @@ -115,6 +110,247 @@ public partial interface IFrontDoorManagementClient : System.IDisposable /// IManagedRuleSetsOperations ManagedRuleSets { get; } + /// + /// Gets an NetworkExperiment Profile by ProfileName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetNetworkExperimentProfilesByProfileNameWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Creates an NetworkExperiment Profile + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(string profileName, string resourceGroupName, Profile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile + /// name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> UpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(string resourceGroupName, string profileName, ProfileUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task DeleteNetworkExperimentProfilesWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Gets an Experiment by ExperimentName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetExperimentsByExperimentNameWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Creates or updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CreateOrUpdateExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Experiment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> UpdateExperimentsByExperimentNameWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task DeleteExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Gets a Latency Scorecard for a given Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The aggregation interval of the Latency Scorecard. Possible values + /// include: 'Daily', 'Weekly', 'Monthly' + /// + /// + /// The end DateTime of the Latency Scorecard in UTC + /// + /// + /// The country associated with the Latency Scorecard. Values are + /// country ISO codes as specified here- + /// https://www.iso.org/iso-3166-country-codes.html + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetLatencyScorecardsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, string aggregationInterval, string endDateTimeUTC = default(string), string country = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Gets a Timeseries for a given Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The start DateTime of the Timeseries in UTC + /// + /// + /// The end DateTime of the Timeseries in UTC + /// + /// + /// The aggregation interval of the Timeseries. Possible values + /// include: 'Hourly', 'Daily' + /// + /// + /// The type of Timeseries. Possible values include: + /// 'MeasurementCounts', 'LatencyP50', 'LatencyP75', 'LatencyP95' + /// + /// + /// The specific endpoint + /// + /// + /// The country associated with the Timeseries. Values are country ISO + /// codes as specified here- + /// https://www.iso.org/iso-3166-country-codes.html + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetTimeseriesWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, System.DateTime startDateTimeUTC, System.DateTime endDateTimeUTC, string aggregationInterval, string timeseriesType, string endpoint = default(string), string country = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Check the availability of a Front Door resource name. /// @@ -143,5 +379,135 @@ public partial interface IFrontDoorManagementClient : System.IDisposable /// Task> CheckFrontDoorNameAvailabilityWithSubscriptionWithHttpMessagesAsync(CheckNameAvailabilityInput checkFrontDoorNameAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an NetworkExperiment Profile + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// An Network Experiment Profile + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> BeginCreateOrUpdateNetworkExperimentProfilesWithHttpMessagesAsync(string profileName, string resourceGroupName, Profile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Updates an NetworkExperimentProfiles by NetworkExperimentProfile + /// name + /// + /// + /// Updates an NetworkExperimentProfiles + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Profile Update Model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> BeginUpdateNetworkExperimentProfilesByProfilesNameWithHttpMessagesAsync(string resourceGroupName, string profileName, ProfileUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes an NetworkExperiment Profile by ProfileName + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task BeginDeleteNetworkExperimentProfilesWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Creates or updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> BeginCreateOrUpdateExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Experiment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Updates an Experiment by Experiment id + /// + /// + /// Updates an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The Experiment Update Model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> BeginUpdateExperimentsByExperimentNameWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, ExperimentUpdateModel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Deletes an Experiment + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The Experiment identifier associated with the Experiment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task BeginDeleteExperimentsWithHttpMessagesAsync(string resourceGroupName, string profileName, string experimentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontendEndpointsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontendEndpointsOperations.cs index c6018ca5fb04..b72f6e2046e8 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontendEndpointsOperations.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IFrontendEndpointsOperations.cs @@ -79,66 +79,6 @@ public partial interface IFrontendEndpointsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a new frontend endpoint with the specified host name within - /// the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front - /// Door. - /// - /// - /// Frontend endpoint properties needed to create a new 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing frontend endpoint with the specified - /// parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front - /// Door. - /// - /// - /// 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 frontDoorName, string frontendEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Enables a frontendEndpoint for HTTPS traffic /// /// @@ -194,66 +134,6 @@ public partial interface IFrontendEndpointsOperations /// Task DisableHttpsWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a new frontend endpoint with the specified host name within - /// the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front - /// Door. - /// - /// - /// Frontend endpoint properties needed to create a new 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string frontendEndpointName, FrontendEndpoint frontendEndpointParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing frontend endpoint with the specified - /// parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Frontend endpoint which is unique within the Front - /// Door. - /// - /// - /// 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 frontDoorName, string frontendEndpointName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Enables a frontendEndpoint for HTTPS traffic /// /// diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IHealthProbeSettingsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IHealthProbeSettingsOperations.cs deleted file mode 100644 index cfe1548c3386..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IHealthProbeSettingsOperations.cs +++ /dev/null @@ -1,224 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// HealthProbeSettingsOperations operations. - /// - public partial interface IHealthProbeSettingsOperations - { - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a HealthProbeSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front - /// Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new HealthProbeSettings with the specified Rule name - /// within the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front - /// Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing HealthProbeSettings with the specified - /// parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front - /// Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new HealthProbeSettings with the specified Rule name - /// within the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front - /// Door. - /// - /// - /// HealthProbeSettings properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, HealthProbeSettingsModel healthProbeSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing HealthProbeSettings with the specified - /// parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the health probe settings which is unique within the Front - /// Door. - /// - /// - /// 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 frontDoorName, string healthProbeSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all of the HealthProbeSettings within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ILoadBalancingSettingsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ILoadBalancingSettingsOperations.cs deleted file mode 100644 index 2a415ece748a..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ILoadBalancingSettingsOperations.cs +++ /dev/null @@ -1,224 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// LoadBalancingSettingsOperations operations. - /// - public partial interface ILoadBalancingSettingsOperations - { - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a LoadBalancingSettings with the specified Rule name within - /// the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the - /// Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new LoadBalancingSettings with the specified Rule name - /// within the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the - /// Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing LoadBalancingSettings with the specified - /// parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the - /// Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new LoadBalancingSettings with the specified Rule name - /// within the specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the - /// Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing LoadBalancingSettings with the specified - /// parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the - /// Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IPreconfiguredEndpointsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IPreconfiguredEndpointsOperations.cs new file mode 100644 index 000000000000..8b6dcdfd49e5 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IPreconfiguredEndpointsOperations.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PreconfiguredEndpointsOperations operations. + /// + public partial interface IPreconfiguredEndpointsOperations + { + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IProfilesOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IProfilesOperations.cs new file mode 100644 index 000000000000..483bd97baee1 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IProfilesOperations.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProfilesOperations operations. + /// + public partial interface IProfilesOperations + { + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Network Experiment Profiles within a resource group + /// under a subscription + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Network Experiment Profiles within a resource group + /// under a subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IRoutingRulesOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IRoutingRulesOperations.cs deleted file mode 100644 index 1054d2eec3c7..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/IRoutingRulesOperations.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RoutingRulesOperations operations. - /// - public partial interface IRoutingRulesOperations - { - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, RoutingRule routingRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, RoutingRule routingRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperations.cs deleted file mode 100644 index 78bff1e498ec..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperations.cs +++ /dev/null @@ -1,1255 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - 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; - - /// - /// LoadBalancingSettingsOperations operations. - /// - internal partial class LoadBalancingSettingsOperations : IServiceOperations, ILoadBalancingSettingsOperations - { - /// - /// Initializes a new instance of the LoadBalancingSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal LoadBalancingSettingsOperations(FrontDoorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the FrontDoorManagementClient - /// - public FrontDoorManagementClient Client { get; private set; } - - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByFrontDoor", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (loadBalancingSettingsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "loadBalancingSettingsName"); - } - if (loadBalancingSettingsName != null) - { - if (loadBalancingSettingsName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "loadBalancingSettingsName", 90); - } - if (loadBalancingSettingsName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "loadBalancingSettingsName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(loadBalancingSettingsName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "loadBalancingSettingsName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("loadBalancingSettingsName", loadBalancingSettingsName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings/{loadBalancingSettingsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{loadBalancingSettingsName}", System.Uri.EscapeDataString(loadBalancingSettingsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates a new LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes an existing LoadBalancingSettings with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates a new LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (loadBalancingSettingsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "loadBalancingSettingsName"); - } - if (loadBalancingSettingsName != null) - { - if (loadBalancingSettingsName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "loadBalancingSettingsName", 90); - } - if (loadBalancingSettingsName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "loadBalancingSettingsName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(loadBalancingSettingsName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "loadBalancingSettingsName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - if (loadBalancingSettingsParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "loadBalancingSettingsParameters"); - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("loadBalancingSettingsName", loadBalancingSettingsName); - tracingParameters.Add("loadBalancingSettingsParameters", loadBalancingSettingsParameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings/{loadBalancingSettingsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{loadBalancingSettingsName}", System.Uri.EscapeDataString(loadBalancingSettingsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(loadBalancingSettingsParameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(loadBalancingSettingsParameters, 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; - } - - /// - /// Deletes an existing LoadBalancingSettings with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string loadBalancingSettingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (loadBalancingSettingsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "loadBalancingSettingsName"); - } - if (loadBalancingSettingsName != null) - { - if (loadBalancingSettingsName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "loadBalancingSettingsName", 90); - } - if (loadBalancingSettingsName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "loadBalancingSettingsName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(loadBalancingSettingsName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "loadBalancingSettingsName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("loadBalancingSettingsName", loadBalancingSettingsName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/loadBalancingSettings/{loadBalancingSettingsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{loadBalancingSettingsName}", System.Uri.EscapeDataString(loadBalancingSettingsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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 LoadBalancingSettings within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(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, "ListByFrontDoorNext", 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperationsExtensions.cs deleted file mode 100644 index 0f6435bd3e59..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/LoadBalancingSettingsOperationsExtensions.cs +++ /dev/null @@ -1,341 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for LoadBalancingSettingsOperations. - /// - public static partial class LoadBalancingSettingsOperationsExtensions - { - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - public static IPage ListByFrontDoor(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName) - { - return operations.ListByFrontDoorAsync(resourceGroupName, frontDoorName).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorAsync(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorWithHttpMessagesAsync(resourceGroupName, frontDoorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - public static LoadBalancingSettingsModel Get(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName) - { - return operations.GetAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName).GetAwaiter().GetResult(); - } - - /// - /// Gets a LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates a new LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - public static LoadBalancingSettingsModel CreateOrUpdate(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing LoadBalancingSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - public static void Delete(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName) - { - operations.DeleteAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing LoadBalancingSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Creates a new LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - public static LoadBalancingSettingsModel BeginCreateOrUpdate(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new LoadBalancingSettings with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// LoadBalancingSettings properties needed to create a new Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, LoadBalancingSettingsModel loadBalancingSettingsParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, loadBalancingSettingsParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing LoadBalancingSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - public static void BeginDelete(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName) - { - operations.BeginDeleteAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing LoadBalancingSettings with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the load balancing settings which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this ILoadBalancingSettingsOperations operations, string resourceGroupName, string frontDoorName, string loadBalancingSettingsName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, loadBalancingSettingsName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByFrontDoorNext(this ILoadBalancingSettingsOperations operations, string nextPageLink) - { - return operations.ListByFrontDoorNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the LoadBalancingSettings within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorNextAsync(this ILoadBalancingSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ManagedRuleSetsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ManagedRuleSetsOperations.cs index 2a79c6138f41..3f366487cd7e 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ManagedRuleSetsOperations.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ManagedRuleSetsOperations.cs @@ -80,7 +80,7 @@ internal ManagedRuleSetsOperations(FrontDoorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/AggregationInterval.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/AggregationInterval.cs new file mode 100644 index 000000000000..490aab5e25a6 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/AggregationInterval.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + + /// + /// Defines values for AggregationInterval. + /// + public static class AggregationInterval + { + public const string Hourly = "Hourly"; + public const string Daily = "Daily"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/BackendPoolListResult.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/BackendPoolListResult.cs new file mode 100644 index 000000000000..af6c1c79b07e --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/BackendPoolListResult.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the request to list Backend Pools. It contains a list of + /// Backend Pools objects and a URL link to get the next set of results. + /// + public partial class BackendPoolListResult + { + /// + /// Initializes a new instance of the BackendPoolListResult class. + /// + public BackendPoolListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackendPoolListResult class. + /// + /// List of Backend Pools within a Front + /// Door. + /// URL to get the next set of BackendPool + /// objects if there are any. + public BackendPoolListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of Backend Pools within a Front Door. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets or sets URL to get the next set of BackendPool objects if + /// there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Endpoint.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Endpoint.cs new file mode 100644 index 000000000000..b9630c863dd8 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Endpoint.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the endpoint properties + /// + public partial class Endpoint + { + /// + /// Initializes a new instance of the Endpoint class. + /// + public Endpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Endpoint class. + /// + /// The name of the endpoint + /// The endpoint URL + public Endpoint(string name = default(string), string endpointProperty = default(string)) + { + Name = name; + EndpointProperty = endpointProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the endpoint + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the endpoint URL + /// + [JsonProperty(PropertyName = "endpoint")] + public string EndpointProperty { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/EndpointType.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/EndpointType.cs new file mode 100644 index 000000000000..c342107d3d7f --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/EndpointType.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.FrontDoor.Models +{ + + /// + /// Defines values for EndpointType. + /// + public static class EndpointType + { + public const string AFD = "AFD"; + public const string AzureRegion = "AzureRegion"; + public const string CDN = "CDN"; + public const string ATM = "ATM"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Experiment.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Experiment.cs new file mode 100644 index 000000000000..00ee2127800c --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Experiment.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the properties of an Experiment + /// + [Rest.Serialization.JsonTransformation] + public partial class Experiment : Resource + { + /// + /// Initializes a new instance of the Experiment class. + /// + public Experiment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Experiment class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The description of the details or intents + /// of the Experiment + /// The endpoint A of an experiment + /// The endpoint B of an experiment + /// The state of the Experiment. Possible + /// values include: 'Enabled', 'Disabled' + /// Resource status. Possible values + /// include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + /// 'Disabled', 'Deleting' + /// The description of Experiment status from the + /// server side + /// The uri to the Script used in the + /// Experiment + public Experiment(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), Endpoint endpointA = default(Endpoint), Endpoint endpointB = default(Endpoint), string enabledState = default(string), string resourceState = default(string), string status = default(string), string scriptFileUri = default(string)) + : base(id, name, type, location, tags) + { + Description = description; + EndpointA = endpointA; + EndpointB = endpointB; + EnabledState = enabledState; + ResourceState = resourceState; + Status = status; + ScriptFileUri = scriptFileUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the details or intents of the + /// Experiment + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the endpoint A of an experiment + /// + [JsonProperty(PropertyName = "properties.endpointA")] + public Endpoint EndpointA { get; set; } + + /// + /// Gets or sets the endpoint B of an experiment + /// + [JsonProperty(PropertyName = "properties.endpointB")] + public Endpoint EndpointB { get; set; } + + /// + /// Gets or sets the state of the Experiment. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.enabledState")] + public string EnabledState { get; set; } + + /// + /// Gets or sets resource status. Possible values include: 'Creating', + /// 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.resourceState")] + public string ResourceState { get; set; } + + /// + /// Gets the description of Experiment status from the server side + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the uri to the Script used in the Experiment + /// + [JsonProperty(PropertyName = "properties.scriptFileUri")] + public string ScriptFileUri { get; private set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ExperimentUpdateModel.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ExperimentUpdateModel.cs new file mode 100644 index 000000000000..46702f593bd4 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ExperimentUpdateModel.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines modifiable attributes of an Experiment + /// + [Rest.Serialization.JsonTransformation] + public partial class ExperimentUpdateModel + { + /// + /// Initializes a new instance of the ExperimentUpdateModel class. + /// + public ExperimentUpdateModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExperimentUpdateModel class. + /// + /// Resource tags. + /// The description of the intent or details + /// of the Experiment + /// The state of the Experiment. Possible + /// values include: 'Enabled', 'Disabled' + public ExperimentUpdateModel(IDictionary tags = default(IDictionary), string description = default(string), string enabledState = default(string)) + { + Tags = tags; + Description = description; + EnabledState = enabledState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the description of the intent or details of the + /// Experiment + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the state of the Experiment. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.enabledState")] + public string EnabledState { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/HealthProbeSettingsListResult.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/HealthProbeSettingsListResult.cs new file mode 100644 index 000000000000..c279c07d5f84 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/HealthProbeSettingsListResult.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the request to list HealthProbeSettings. It contains a list + /// of HealthProbeSettings objects and a URL link to get the next set of + /// results. + /// + public partial class HealthProbeSettingsListResult + { + /// + /// Initializes a new instance of the HealthProbeSettingsListResult + /// class. + /// + public HealthProbeSettingsListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HealthProbeSettingsListResult + /// class. + /// + /// List of HealthProbeSettings within a Front + /// Door. + /// URL to get the next set of + /// HealthProbeSettings objects if there are any. + public HealthProbeSettingsListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of HealthProbeSettings within a Front Door. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets or sets URL to get the next set of HealthProbeSettings objects + /// if there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyMetric.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyMetric.cs new file mode 100644 index 000000000000..186e288dbb0b --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyMetric.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.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the properties of a latency metric used in the latency + /// scorecard + /// + public partial class LatencyMetric + { + /// + /// Initializes a new instance of the LatencyMetric class. + /// + public LatencyMetric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LatencyMetric class. + /// + /// The name of the Latency Metric + /// The end time of the Latency Scorecard + /// in UTC + /// The metric value of the A endpoint + /// The metric value of the B endpoint + /// The difference in value between endpoint A and + /// B + /// The percent difference between endpoint + /// A and B + /// The lower end of the 95% confidence + /// interval for endpoint A + /// The upper end of the 95% confidence + /// interval for endpoint A + /// The lower end of the 95% confidence + /// interval for endpoint B + /// The upper end of the 95% confidence + /// interval for endpoint B + public LatencyMetric(string name = default(string), string endDateTimeUTC = default(string), double? aValue = default(double?), double? bValue = default(double?), double? delta = default(double?), double? deltaPercent = default(double?), double? aCLower95CI = default(double?), double? aHUpper95CI = default(double?), double? bCLower95CI = default(double?), double? bUpper95CI = default(double?)) + { + Name = name; + EndDateTimeUTC = endDateTimeUTC; + AValue = aValue; + BValue = bValue; + Delta = delta; + DeltaPercent = deltaPercent; + ACLower95CI = aCLower95CI; + AHUpper95CI = aHUpper95CI; + BCLower95CI = bCLower95CI; + BUpper95CI = bUpper95CI; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the Latency Metric + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the end time of the Latency Scorecard in UTC + /// + [JsonProperty(PropertyName = "endDateTimeUTC")] + public string EndDateTimeUTC { get; private set; } + + /// + /// Gets the metric value of the A endpoint + /// + [JsonProperty(PropertyName = "aValue")] + public double? AValue { get; private set; } + + /// + /// Gets the metric value of the B endpoint + /// + [JsonProperty(PropertyName = "bValue")] + public double? BValue { get; private set; } + + /// + /// Gets the difference in value between endpoint A and B + /// + [JsonProperty(PropertyName = "delta")] + public double? Delta { get; private set; } + + /// + /// Gets the percent difference between endpoint A and B + /// + [JsonProperty(PropertyName = "deltaPercent")] + public double? DeltaPercent { get; private set; } + + /// + /// Gets the lower end of the 95% confidence interval for endpoint A + /// + [JsonProperty(PropertyName = "aCLower95CI")] + public double? ACLower95CI { get; private set; } + + /// + /// Gets the upper end of the 95% confidence interval for endpoint A + /// + [JsonProperty(PropertyName = "aHUpper95CI")] + public double? AHUpper95CI { get; private set; } + + /// + /// Gets the lower end of the 95% confidence interval for endpoint B + /// + [JsonProperty(PropertyName = "bCLower95CI")] + public double? BCLower95CI { get; private set; } + + /// + /// Gets the upper end of the 95% confidence interval for endpoint B + /// + [JsonProperty(PropertyName = "bUpper95CI")] + public double? BUpper95CI { get; private set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecard.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecard.cs new file mode 100644 index 000000000000..6a9bdd1934e1 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecard.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the LatencyScorecard + /// + [Rest.Serialization.JsonTransformation] + public partial class LatencyScorecard : Resource + { + /// + /// Initializes a new instance of the LatencyScorecard class. + /// + public LatencyScorecard() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LatencyScorecard class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The unique identifier of the + /// Latency Scorecard + /// The name of the Latency + /// Scorecard + /// The description of the Latency + /// Scorecard + /// The A endpoint in the scorecard + /// The B endpoint in the scorecard + /// The start time of the Latency + /// Scorecard in UTC + /// The end time of the Latency Scorecard + /// in UTC + /// The country associated with the Latency + /// Scorecard. Values are country ISO codes as specified here- + /// https://www.iso.org/iso-3166-country-codes.html + /// The latency metrics of the Latency + /// Scorecard + public LatencyScorecard(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string latencyScorecardId = default(string), string latencyScorecardName = default(string), string description = default(string), string endpointA = default(string), string endpointB = default(string), System.DateTime? startDateTimeUTC = default(System.DateTime?), System.DateTime? endDateTimeUTC = default(System.DateTime?), string country = default(string), IList latencyMetrics = default(IList)) + : base(id, name, type, location, tags) + { + LatencyScorecardId = latencyScorecardId; + LatencyScorecardName = latencyScorecardName; + Description = description; + EndpointA = endpointA; + EndpointB = endpointB; + StartDateTimeUTC = startDateTimeUTC; + EndDateTimeUTC = endDateTimeUTC; + Country = country; + LatencyMetrics = latencyMetrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique identifier of the Latency Scorecard + /// + [JsonProperty(PropertyName = "properties.id")] + public string LatencyScorecardId { get; private set; } + + /// + /// Gets the name of the Latency Scorecard + /// + [JsonProperty(PropertyName = "properties.name")] + public string LatencyScorecardName { get; private set; } + + /// + /// Gets the description of the Latency Scorecard + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the A endpoint in the scorecard + /// + [JsonProperty(PropertyName = "properties.endpointA")] + public string EndpointA { get; private set; } + + /// + /// Gets the B endpoint in the scorecard + /// + [JsonProperty(PropertyName = "properties.endpointB")] + public string EndpointB { get; private set; } + + /// + /// Gets the start time of the Latency Scorecard in UTC + /// + [JsonProperty(PropertyName = "properties.startDateTimeUTC")] + public System.DateTime? StartDateTimeUTC { get; private set; } + + /// + /// Gets the end time of the Latency Scorecard in UTC + /// + [JsonProperty(PropertyName = "properties.endDateTimeUTC")] + public System.DateTime? EndDateTimeUTC { get; private set; } + + /// + /// Gets the country associated with the Latency Scorecard. Values are + /// country ISO codes as specified here- + /// https://www.iso.org/iso-3166-country-codes.html + /// + [JsonProperty(PropertyName = "properties.country")] + public string Country { get; private set; } + + /// + /// Gets or sets the latency metrics of the Latency Scorecard + /// + [JsonProperty(PropertyName = "properties.latencyMetrics")] + public IList LatencyMetrics { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecardAggregationInterval.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecardAggregationInterval.cs new file mode 100644 index 000000000000..4a27788cdcb2 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LatencyScorecardAggregationInterval.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.FrontDoor.Models +{ + + /// + /// Defines values for LatencyScorecardAggregationInterval. + /// + public static class LatencyScorecardAggregationInterval + { + public const string Daily = "Daily"; + public const string Weekly = "Weekly"; + public const string Monthly = "Monthly"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LoadBalancingSettingsListResult.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LoadBalancingSettingsListResult.cs new file mode 100644 index 000000000000..54dea6049de5 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/LoadBalancingSettingsListResult.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the request to list load balancing settings. It contains a + /// list of load balancing settings objects and a URL link to get the next + /// set of results. + /// + public partial class LoadBalancingSettingsListResult + { + /// + /// Initializes a new instance of the LoadBalancingSettingsListResult + /// class. + /// + public LoadBalancingSettingsListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadBalancingSettingsListResult + /// class. + /// + /// List of Backend Pools within a Front + /// Door. + /// URL to get the next set of + /// LoadBalancingSettings objects if there are any. + public LoadBalancingSettingsListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of Backend Pools within a Front Door. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets or sets URL to get the next set of LoadBalancingSettings + /// objects if there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleDefinition.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleDefinition.cs index 81dc7e9d18ab..914644c759a3 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleDefinition.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleDefinition.cs @@ -30,11 +30,19 @@ public ManagedRuleDefinition() /// Initializes a new instance of the ManagedRuleDefinition class. /// /// Identifier for the managed rule. + /// Describes the default state for the + /// managed rule. Possible values include: 'Disabled', + /// 'Enabled' + /// Describes the default action to be + /// applied when the managed rule matches. Possible values include: + /// 'Allow', 'Block', 'Log', 'Redirect' /// Describes the functionality of the /// managed rule. - public ManagedRuleDefinition(string ruleId = default(string), string description = default(string)) + public ManagedRuleDefinition(string ruleId = default(string), string defaultState = default(string), string defaultAction = default(string), string description = default(string)) { RuleId = ruleId; + DefaultState = defaultState; + DefaultAction = defaultAction; Description = description; CustomInit(); } @@ -50,6 +58,21 @@ public ManagedRuleDefinition() [JsonProperty(PropertyName = "ruleId")] public string RuleId { get; private set; } + /// + /// Gets describes the default state for the managed rule. Possible + /// values include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "defaultState")] + public string DefaultState { get; private set; } + + /// + /// Gets describes the default action to be applied when the managed + /// rule matches. Possible values include: 'Allow', 'Block', 'Log', + /// 'Redirect' + /// + [JsonProperty(PropertyName = "defaultAction")] + public string DefaultAction { get; private set; } + /// /// Gets describes the functionality of the managed rule. /// diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusion.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusion.cs new file mode 100644 index 000000000000..c5c5f76ed355 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusion.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Exclude variables from managed rule evaluation. + /// + public partial class ManagedRuleExclusion + { + /// + /// Initializes a new instance of the ManagedRuleExclusion class. + /// + public ManagedRuleExclusion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleExclusion class. + /// + /// The variable type to be excluded. + /// Possible values include: 'RequestHeaderNames', + /// 'RequestCookieNames', 'QueryStringArgNames', + /// 'RequestBodyPostArgNames' + /// Comparison operator to apply to + /// the selector when specifying which elements in the collection this + /// exclusion applies to. Possible values include: 'Equals', + /// 'Contains', 'StartsWith', 'EndsWith', 'EqualsAny' + /// Selector value for which elements in the + /// collection this exclusion applies to. + public ManagedRuleExclusion(string matchVariable, string selectorMatchOperator, string selector) + { + MatchVariable = matchVariable; + SelectorMatchOperator = selectorMatchOperator; + Selector = selector; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the variable type to be excluded. Possible values + /// include: 'RequestHeaderNames', 'RequestCookieNames', + /// 'QueryStringArgNames', 'RequestBodyPostArgNames' + /// + [JsonProperty(PropertyName = "matchVariable")] + public string MatchVariable { get; set; } + + /// + /// Gets or sets comparison operator to apply to the selector when + /// specifying which elements in the collection this exclusion applies + /// to. Possible values include: 'Equals', 'Contains', 'StartsWith', + /// 'EndsWith', 'EqualsAny' + /// + [JsonProperty(PropertyName = "selectorMatchOperator")] + public string SelectorMatchOperator { get; set; } + + /// + /// Gets or sets selector value for which elements in the collection + /// this exclusion applies to. + /// + [JsonProperty(PropertyName = "selector")] + public string Selector { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MatchVariable == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MatchVariable"); + } + if (SelectorMatchOperator == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SelectorMatchOperator"); + } + if (Selector == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Selector"); + } + } + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionMatchVariable.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionMatchVariable.cs new file mode 100644 index 000000000000..87c7c9eab51b --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionMatchVariable.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.FrontDoor.Models +{ + + /// + /// Defines values for ManagedRuleExclusionMatchVariable. + /// + public static class ManagedRuleExclusionMatchVariable + { + public const string RequestHeaderNames = "RequestHeaderNames"; + public const string RequestCookieNames = "RequestCookieNames"; + public const string QueryStringArgNames = "QueryStringArgNames"; + public const string RequestBodyPostArgNames = "RequestBodyPostArgNames"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionSelectorMatchOperator.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionSelectorMatchOperator.cs new file mode 100644 index 000000000000..9c1be80bd58f --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleExclusionSelectorMatchOperator.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.FrontDoor.Models +{ + + /// + /// Defines values for ManagedRuleExclusionSelectorMatchOperator. + /// + public static class ManagedRuleExclusionSelectorMatchOperator + { + public const string Equals = "Equals"; + public const string Contains = "Contains"; + public const string StartsWith = "StartsWith"; + public const string EndsWith = "EndsWith"; + public const string EqualsAny = "EqualsAny"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleGroupOverride.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleGroupOverride.cs index a28cb3977188..c84021692800 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleGroupOverride.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleGroupOverride.cs @@ -34,11 +34,14 @@ public ManagedRuleGroupOverride() /// /// Describes the managed rule group to /// override. + /// Describes the exclusions that are applied + /// to all rules in the group. /// 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)) + public ManagedRuleGroupOverride(string ruleGroupName, IList exclusions = default(IList), IList rules = default(IList)) { RuleGroupName = ruleGroupName; + Exclusions = exclusions; Rules = rules; CustomInit(); } @@ -54,6 +57,13 @@ public ManagedRuleGroupOverride() [JsonProperty(PropertyName = "ruleGroupName")] public string RuleGroupName { get; set; } + /// + /// Gets or sets describes the exclusions that are applied to all rules + /// in the group. + /// + [JsonProperty(PropertyName = "exclusions")] + public IList Exclusions { get; set; } + /// /// Gets or sets list of rules that will be disabled. If none /// specified, all rules in the group will be disabled. @@ -73,9 +83,9 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "RuleGroupName"); } - if (Rules != null) + if (Exclusions != null) { - foreach (var element in Rules) + foreach (var element in Exclusions) { if (element != null) { @@ -83,6 +93,16 @@ public virtual void Validate() } } } + if (Rules != null) + { + foreach (var element1 in Rules) + { + if (element1 != null) + { + element1.Validate(); + } + } + } } } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleOverride.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleOverride.cs index e223322f32c8..59791ac241a5 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleOverride.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleOverride.cs @@ -12,6 +12,8 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -37,11 +39,14 @@ public ManagedRuleOverride() /// 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)) + /// Describes the exclusions that are applied + /// to this specific rule. + public ManagedRuleOverride(string ruleId, string enabledState = default(string), string action = default(string), IList exclusions = default(IList)) { RuleId = ruleId; EnabledState = enabledState; Action = action; + Exclusions = exclusions; CustomInit(); } @@ -72,6 +77,13 @@ public ManagedRuleOverride() [JsonProperty(PropertyName = "action")] public string Action { get; set; } + /// + /// Gets or sets describes the exclusions that are applied to this + /// specific rule. + /// + [JsonProperty(PropertyName = "exclusions")] + public IList Exclusions { get; set; } + /// /// Validate the object. /// @@ -84,6 +96,16 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "RuleId"); } + if (Exclusions != null) + { + foreach (var element in Exclusions) + { + if (element != null) + { + element.Validate(); + } + } + } } } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleSet.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleSet.cs index d34955a22aa2..6cbab6558be0 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleSet.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ManagedRuleSet.cs @@ -35,12 +35,15 @@ public ManagedRuleSet() /// Defines the rule set type to use. /// Defines the version of the rule set to /// use. + /// Describes the exclusions that are applied + /// to all rules in the set. /// Defines the rule group overrides /// to apply to the rule set. - public ManagedRuleSet(string ruleSetType, string ruleSetVersion, IList ruleGroupOverrides = default(IList)) + public ManagedRuleSet(string ruleSetType, string ruleSetVersion, IList exclusions = default(IList), IList ruleGroupOverrides = default(IList)) { RuleSetType = ruleSetType; RuleSetVersion = ruleSetVersion; + Exclusions = exclusions; RuleGroupOverrides = ruleGroupOverrides; CustomInit(); } @@ -62,6 +65,13 @@ public ManagedRuleSet() [JsonProperty(PropertyName = "ruleSetVersion")] public string RuleSetVersion { get; set; } + /// + /// Gets or sets describes the exclusions that are applied to all rules + /// in the set. + /// + [JsonProperty(PropertyName = "exclusions")] + public IList Exclusions { get; set; } + /// /// Gets or sets defines the rule group overrides to apply to the rule /// set. @@ -85,9 +95,9 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "RuleSetVersion"); } - if (RuleGroupOverrides != null) + if (Exclusions != null) { - foreach (var element in RuleGroupOverrides) + foreach (var element in Exclusions) { if (element != null) { @@ -95,6 +105,16 @@ public virtual void Validate() } } } + if (RuleGroupOverrides != null) + { + foreach (var element1 in RuleGroupOverrides) + { + if (element1 != null) + { + element1.Validate(); + } + } + } } } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchCondition.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchCondition.cs index 8936696e6c0b..453f38b18424 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchCondition.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchCondition.cs @@ -35,7 +35,7 @@ public MatchCondition() /// Request variable to compare with. /// Possible values include: 'RemoteAddr', 'RequestMethod', /// 'QueryString', 'PostArgs', 'RequestUri', 'RequestHeader', - /// 'RequestBody', 'Cookies' + /// 'RequestBody', 'Cookies', 'SocketAddr' /// Comparison type to use for matching /// with the variable value. Possible values include: 'Any', 'IPMatch', /// 'GeoMatch', 'Equal', 'Contains', 'LessThan', 'GreaterThan', @@ -67,7 +67,8 @@ public MatchCondition() /// /// Gets or sets request variable to compare with. Possible values /// include: 'RemoteAddr', 'RequestMethod', 'QueryString', 'PostArgs', - /// 'RequestUri', 'RequestHeader', 'RequestBody', 'Cookies' + /// 'RequestUri', 'RequestHeader', 'RequestBody', 'Cookies', + /// 'SocketAddr' /// [JsonProperty(PropertyName = "matchVariable")] public string MatchVariable { get; set; } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchVariable.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchVariable.cs index c2b72181268f..3be7ab12788f 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchVariable.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/MatchVariable.cs @@ -24,5 +24,6 @@ public static class MatchVariable public const string RequestHeader = "RequestHeader"; public const string RequestBody = "RequestBody"; public const string Cookies = "Cookies"; + public const string SocketAddr = "SocketAddr"; } } diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/NetworkExperimentResourceState.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/NetworkExperimentResourceState.cs new file mode 100644 index 000000000000..63f4a4540313 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/NetworkExperimentResourceState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + + /// + /// Defines values for NetworkExperimentResourceState. + /// + public static class NetworkExperimentResourceState + { + 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/PreconfiguredEndpoint.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/PreconfiguredEndpoint.cs new file mode 100644 index 000000000000..5ab707a7fd36 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/PreconfiguredEndpoint.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the properties of a preconfigured endpoint + /// + [Rest.Serialization.JsonTransformation] + public partial class PreconfiguredEndpoint : Resource + { + /// + /// Initializes a new instance of the PreconfiguredEndpoint class. + /// + public PreconfiguredEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PreconfiguredEndpoint class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The description of the endpoint + /// The endpoint that is preconfigured + /// The type of endpoint. Possible values + /// include: 'AFD', 'AzureRegion', 'CDN', 'ATM' + /// The preconfigured endpoint backend + public PreconfiguredEndpoint(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string description = default(string), string endpoint = default(string), string endpointType = default(string), string backend = default(string)) + : base(id, name, type, location, tags) + { + Description = description; + Endpoint = endpoint; + EndpointType = endpointType; + Backend = backend; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description of the endpoint + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the endpoint that is preconfigured + /// + [JsonProperty(PropertyName = "properties.endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets the type of endpoint. Possible values include: 'AFD', + /// 'AzureRegion', 'CDN', 'ATM' + /// + [JsonProperty(PropertyName = "properties.endpointType")] + public string EndpointType { get; set; } + + /// + /// Gets or sets the preconfigured endpoint backend + /// + [JsonProperty(PropertyName = "properties.backend")] + public string Backend { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Profile.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Profile.cs new file mode 100644 index 000000000000..4ce2100f2960 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Profile.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines an Network Experiment Profile and lists of Experiments + /// + [Rest.Serialization.JsonTransformation] + public partial class Profile : Resource + { + /// + /// Initializes a new instance of the Profile class. + /// + public Profile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Profile class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// Resource status. Possible values + /// include: 'Creating', 'Enabling', 'Enabled', 'Disabling', + /// 'Disabled', 'Deleting' + /// The state of the Experiment. Possible + /// values include: 'Enabled', 'Disabled' + /// Gets a unique read-only string that changes + /// whenever the resource is updated. + public Profile(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string resourceState = default(string), string enabledState = default(string), string etag = default(string)) + : base(id, name, type, location, tags) + { + ResourceState = resourceState; + EnabledState = enabledState; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource status. Possible values include: 'Creating', + /// 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.resourceState")] + public string ResourceState { get; set; } + + /// + /// Gets or sets the state of the Experiment. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.enabledState")] + public string EnabledState { get; set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ProfileUpdateModel.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ProfileUpdateModel.cs new file mode 100644 index 000000000000..78072081f2f3 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/ProfileUpdateModel.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.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines modifiable attributes of a Profile + /// + [Rest.Serialization.JsonTransformation] + public partial class ProfileUpdateModel + { + /// + /// Initializes a new instance of the ProfileUpdateModel class. + /// + public ProfileUpdateModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProfileUpdateModel class. + /// + /// The enabled state of the Profile. + /// Possible values include: 'Enabled', 'Disabled' + /// Resource tags. + public ProfileUpdateModel(string enabledState = default(string), IDictionary tags = default(IDictionary)) + { + EnabledState = enabledState; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the enabled state of the Profile. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.enabledState")] + public string EnabledState { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/RoutingRuleListResult.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/RoutingRuleListResult.cs new file mode 100644 index 000000000000..bd4ac0d519f6 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/RoutingRuleListResult.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the request to list Routing Rules. It contains a list of + /// Routing Rule objects and a URL link to get the next set of results. + /// + public partial class RoutingRuleListResult + { + /// + /// Initializes a new instance of the RoutingRuleListResult class. + /// + public RoutingRuleListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoutingRuleListResult class. + /// + /// List of Routing Rules within a Front + /// Door. + /// URL to get the next set of RoutingRule + /// objects if there are any. + public RoutingRuleListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of Routing Rules within a Front Door. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets or sets URL to get the next set of RoutingRule objects if + /// there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/State.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/State.cs new file mode 100644 index 000000000000..d14265742442 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/State.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + + /// + /// Defines values for State. + /// + public static class State + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Timeseries.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Timeseries.cs new file mode 100644 index 000000000000..a3d5327be10b --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/Timeseries.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the Timeseries + /// + [Rest.Serialization.JsonTransformation] + public partial class Timeseries : Resource + { + /// + /// Initializes a new instance of the Timeseries class. + /// + public Timeseries() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Timeseries class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The endpoint associated with the Timeseries + /// data point + /// The start DateTime of the Timeseries + /// in UTC + /// The end DateTime of the Timeseries in + /// UTC + /// The aggregation interval of the + /// Timeseries. Possible values include: 'Hourly', 'Daily' + /// The type of Timeseries. Possible + /// values include: 'MeasurementCounts', 'LatencyP50', 'LatencyP75', + /// 'LatencyP95' + /// The country associated with the Timeseries. + /// Values are country ISO codes as specified here- + /// https://www.iso.org/iso-3166-country-codes.html + /// The set of data points for the + /// timeseries + public Timeseries(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string endpoint = default(string), string startDateTimeUTC = default(string), string endDateTimeUTC = default(string), string aggregationInterval = default(string), string timeseriesType = default(string), string country = default(string), IList timeseriesData = default(IList)) + : base(id, name, type, location, tags) + { + Endpoint = endpoint; + StartDateTimeUTC = startDateTimeUTC; + EndDateTimeUTC = endDateTimeUTC; + AggregationInterval = aggregationInterval; + TimeseriesType = timeseriesType; + Country = country; + TimeseriesData = timeseriesData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the endpoint associated with the Timeseries data point + /// + [JsonProperty(PropertyName = "properties.endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets the start DateTime of the Timeseries in UTC + /// + [JsonProperty(PropertyName = "properties.startDateTimeUTC")] + public string StartDateTimeUTC { get; set; } + + /// + /// Gets or sets the end DateTime of the Timeseries in UTC + /// + [JsonProperty(PropertyName = "properties.endDateTimeUTC")] + public string EndDateTimeUTC { get; set; } + + /// + /// Gets or sets the aggregation interval of the Timeseries. Possible + /// values include: 'Hourly', 'Daily' + /// + [JsonProperty(PropertyName = "properties.aggregationInterval")] + public string AggregationInterval { get; set; } + + /// + /// Gets or sets the type of Timeseries. Possible values include: + /// 'MeasurementCounts', 'LatencyP50', 'LatencyP75', 'LatencyP95' + /// + [JsonProperty(PropertyName = "properties.timeseriesType")] + public string TimeseriesType { get; set; } + + /// + /// Gets or sets the country associated with the Timeseries. Values are + /// country ISO codes as specified here- + /// https://www.iso.org/iso-3166-country-codes.html + /// + [JsonProperty(PropertyName = "properties.country")] + public string Country { get; set; } + + /// + /// Gets or sets the set of data points for the timeseries + /// + [JsonProperty(PropertyName = "properties.timeseriesData")] + public IList TimeseriesData { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesAggregationInterval.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesAggregationInterval.cs new file mode 100644 index 000000000000..49f6a06d768f --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesAggregationInterval.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + + /// + /// Defines values for TimeseriesAggregationInterval. + /// + public static class TimeseriesAggregationInterval + { + public const string Hourly = "Hourly"; + public const string Daily = "Daily"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesDataPoint.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesDataPoint.cs new file mode 100644 index 000000000000..705cc74ef1b7 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesDataPoint.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines a timeseries datapoint used in a timeseries + /// + public partial class TimeseriesDataPoint + { + /// + /// Initializes a new instance of the TimeseriesDataPoint class. + /// + public TimeseriesDataPoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeseriesDataPoint class. + /// + /// The DateTime of the Timeseries data point + /// in UTC + /// The Value of the Timeseries data point + public TimeseriesDataPoint(string dateTimeUTC = default(string), double? value = default(double?)) + { + DateTimeUTC = dateTimeUTC; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the DateTime of the Timeseries data point in UTC + /// + [JsonProperty(PropertyName = "dateTimeUTC")] + public string DateTimeUTC { get; set; } + + /// + /// Gets or sets the Value of the Timeseries data point + /// + [JsonProperty(PropertyName = "value")] + public double? Value { get; set; } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesType.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesType.cs new file mode 100644 index 000000000000..44de6bbcede9 --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/Models/TimeseriesType.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.FrontDoor.Models +{ + + /// + /// Defines values for TimeseriesType. + /// + public static class TimeseriesType + { + public const string MeasurementCounts = "MeasurementCounts"; + public const string LatencyP50 = "LatencyP50"; + public const string LatencyP75 = "LatencyP75"; + public const string LatencyP95 = "LatencyP95"; + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PoliciesOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PoliciesOperations.cs index 6b1c32eb839c..583e9daba588 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PoliciesOperations.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PoliciesOperations.cs @@ -102,7 +102,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -311,7 +311,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,7 +582,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) { parameters.Validate(); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -833,7 +833,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-03-01"; + string apiVersion = "2019-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperations.cs new file mode 100644 index 000000000000..ca1eb252263a --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperations.cs @@ -0,0 +1,433 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PreconfiguredEndpointsOperations operations. + /// + internal partial class PreconfiguredEndpointsOperations : IServiceOperations, IPreconfiguredEndpointsOperations + { + /// + /// Initializes a new instance of the PreconfiguredEndpointsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PreconfiguredEndpointsOperations(FrontDoorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the FrontDoorManagementClient + /// + public FrontDoorManagementClient Client { get; private set; } + + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string profileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (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 (profileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "profileName"); + } + if (profileName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(profileName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "profileName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } + string apiVersion = "2019-11-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("profileName", profileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/PreconfiguredEndpoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{profileName}", System.Uri.EscapeDataString(profileName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperationsExtensions.cs new file mode 100644 index 000000000000..1419b0bffbfc --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/PreconfiguredEndpointsOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PreconfiguredEndpointsOperations. + /// + public static partial class PreconfiguredEndpointsOperationsExtensions + { + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + public static IPage List(this IPreconfiguredEndpointsOperations operations, string resourceGroupName, string profileName) + { + return operations.ListAsync(resourceGroupName, profileName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The Profile identifier associated with the Tenant and Partner + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPreconfiguredEndpointsOperations operations, string resourceGroupName, string profileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, profileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPreconfiguredEndpointsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Preconfigured Endpoints + /// + /// + /// 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 IPreconfiguredEndpointsOperations 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperations.cs similarity index 52% rename from sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperations.cs rename to sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperations.cs index febf5b0cb527..d2f3110f1c96 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/BackendPoolsOperations.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.FrontDoor using System.Threading.Tasks; /// - /// BackendPoolsOperations operations. + /// ProfilesOperations operations. /// - internal partial class BackendPoolsOperations : IServiceOperations, IBackendPoolsOperations + internal partial class ProfilesOperations : IServiceOperations, IProfilesOperations { /// - /// Initializes a new instance of the BackendPoolsOperations class. + /// Initializes a new instance of the ProfilesOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class BackendPoolsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BackendPoolsOperations(FrontDoorManagementClient client) + internal ProfilesOperations(FrontDoorManagementClient client) { if (client == null) { @@ -51,14 +51,8 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) public FrontDoorManagementClient Client { get; private set; } /// - /// Lists all of the Backend Pools within a Front Door. + /// Gets a list of Network Experiment Profiles under a subscription /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// /// /// Headers that will be added to request. /// @@ -80,51 +74,13 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; + string apiVersion = "2019-11-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -132,18 +88,14 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByFrontDoor", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); List _queryParameters = new List(); if (apiVersion != null) { @@ -237,7 +189,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -250,7 +202,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -270,18 +222,12 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) } /// - /// Gets a Backend Pool with the specified Pool name within the specified Front - /// Door. + /// Gets a list of Network Experiment Profiles within a resource group under a + /// subscription /// /// /// Name of the Resource group within the Azure subscription. /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// /// /// Headers that will be added to request. /// @@ -303,7 +249,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string backendPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -328,45 +274,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); } } - if (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (backendPoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "backendPoolName"); - } - if (backendPoolName != null) - { - if (backendPoolName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "backendPoolName", 90); - } - if (backendPoolName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "backendPoolName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(backendPoolName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "backendPoolName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; + string apiVersion = "2019-11-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -374,20 +282,16 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("backendPoolName", backendPoolName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools/{backendPoolName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{backendPoolName}", System.Uri.EscapeDataString(backendPoolName)); List _queryParameters = new List(); if (apiVersion != null) { @@ -481,7 +385,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -494,7 +398,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -514,74 +418,10 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) } /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. + /// Gets a list of Network Experiment Profiles under a subscription /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string backendPoolName, BackendPool backendPoolParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, backendPoolParameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string backendPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, backendPoolName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates a new Backend Pool with the specified Pool name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// Backend Pool properties needed to create a new Pool. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -604,74 +444,12 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string backendPoolName, BackendPool backendPoolParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (backendPoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "backendPoolName"); - } - if (backendPoolName != null) - { - if (backendPoolName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "backendPoolName", 90); - } - if (backendPoolName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "backendPoolName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(backendPoolName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "backendPoolName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - if (backendPoolParameters == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "backendPoolParameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2019-05-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -679,26 +457,14 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("backendPoolName", backendPoolName); - tracingParameters.Add("backendPoolParameters", backendPoolParameters); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools/{backendPoolName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{backendPoolName}", System.Uri.EscapeDataString(backendPoolName)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -706,7 +472,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -737,12 +503,6 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) // Serialize Request string _requestContent = null; - if(backendPoolParameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(backendPoolParameters, 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) { @@ -763,7 +523,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -793,7 +553,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -806,7 +566,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -818,264 +578,6 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) 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; - } - - /// - /// Deletes an existing Backend Pool with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Backend Pool which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string backendPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (backendPoolName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "backendPoolName"); - } - if (backendPoolName != null) - { - if (backendPoolName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "backendPoolName", 90); - } - if (backendPoolName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "backendPoolName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(backendPoolName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "backendPoolName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("backendPoolName", backendPoolName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/backendPools/{backendPoolName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{backendPoolName}", System.Uri.EscapeDataString(backendPoolName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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); @@ -1084,7 +586,8 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) } /// - /// Lists all of the Backend Pools within a Front Door. + /// Gets a list of Network Experiment Profiles within a resource group under a + /// subscription /// /// /// The NextLink from the previous successful call to List operation. @@ -1110,7 +613,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByFrontDoorNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1125,7 +628,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByFrontDoorNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1219,7 +722,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1232,7 +735,7 @@ internal BackendPoolsOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperationsExtensions.cs new file mode 100644 index 000000000000..fcc2e5e867ff --- /dev/null +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/ProfilesOperationsExtensions.cs @@ -0,0 +1,159 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProfilesOperations. + /// + public static partial class ProfilesOperationsExtensions + { + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IProfilesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProfilesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Network Experiment Profiles within a resource group under a + /// subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + public static IPage ListByResourceGroup(this IProfilesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Network Experiment Profiles within a resource group under a + /// subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IProfilesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IProfilesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IProfilesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Network Experiment Profiles within a resource group under a + /// subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IProfilesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Network Experiment Profiles within a resource group under a + /// subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IProfilesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperations.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperations.cs deleted file mode 100644 index 1d640542e393..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperations.cs +++ /dev/null @@ -1,1255 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - 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; - - /// - /// RoutingRulesOperations operations. - /// - internal partial class RoutingRulesOperations : IServiceOperations, IRoutingRulesOperations - { - /// - /// Initializes a new instance of the RoutingRulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RoutingRulesOperations(FrontDoorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the FrontDoorManagementClient - /// - public FrontDoorManagementClient Client { get; private set; } - - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// 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>> ListByFrontDoorWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByFrontDoor", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a Routing Rule with the specified Rule name within the specified Front - /// Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (routingRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "routingRuleName"); - } - if (routingRuleName != null) - { - if (routingRuleName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "routingRuleName", 90); - } - if (routingRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "routingRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(routingRuleName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "routingRuleName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("routingRuleName", routingRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules/{routingRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{routingRuleName}", System.Uri.EscapeDataString(routingRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string routingRuleName, RoutingRule routingRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string frontDoorName, string routingRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, RoutingRule routingRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (routingRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "routingRuleName"); - } - if (routingRuleName != null) - { - if (routingRuleName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "routingRuleName", 90); - } - if (routingRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "routingRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(routingRuleName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "routingRuleName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - if (routingRuleParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "routingRuleParameters"); - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("routingRuleName", routingRuleName); - tracingParameters.Add("routingRuleParameters", routingRuleParameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules/{routingRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{routingRuleName}", System.Uri.EscapeDataString(routingRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(routingRuleParameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(routingRuleParameters, 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; - } - - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// 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 frontDoorName, string routingRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (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 (frontDoorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "frontDoorName"); - } - if (frontDoorName != null) - { - if (frontDoorName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "frontDoorName", 64); - } - if (frontDoorName.Length < 5) - { - throw new ValidationException(ValidationRules.MinLength, "frontDoorName", 5); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(frontDoorName, "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "frontDoorName", "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"); - } - } - if (routingRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "routingRuleName"); - } - if (routingRuleName != null) - { - if (routingRuleName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "routingRuleName", 90); - } - if (routingRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "routingRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(routingRuleName, "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$")) - { - throw new ValidationException(ValidationRules.Pattern, "routingRuleName", "^[a-zA-Z0-9]+(-*[a-zA-Z0-9])*$"); - } - } - string apiVersion = "2019-05-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("frontDoorName", frontDoorName); - tracingParameters.Add("routingRuleName", routingRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/routingRules/{routingRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{frontDoorName}", System.Uri.EscapeDataString(frontDoorName)); - _url = _url.Replace("{routingRuleName}", System.Uri.EscapeDataString(routingRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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 Routing Rules within a Front Door. - /// - /// - /// 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>> ListByFrontDoorNextWithHttpMessagesAsync(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, "ListByFrontDoorNext", 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/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperationsExtensions.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperationsExtensions.cs deleted file mode 100644 index 79a1131ba92d..000000000000 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/RoutingRulesOperationsExtensions.cs +++ /dev/null @@ -1,341 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.FrontDoor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RoutingRulesOperations. - /// - public static partial class RoutingRulesOperationsExtensions - { - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - public static IPage ListByFrontDoor(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName) - { - return operations.ListByFrontDoorAsync(resourceGroupName, frontDoorName).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorAsync(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorWithHttpMessagesAsync(resourceGroupName, frontDoorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a Routing Rule with the specified Rule name within the specified Front - /// Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - public static RoutingRule Get(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName) - { - return operations.GetAsync(resourceGroupName, frontDoorName, routingRuleName).GetAwaiter().GetResult(); - } - - /// - /// Gets a Routing Rule with the specified Rule name within the specified Front - /// Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - public static RoutingRule CreateOrUpdate(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, RoutingRule routingRuleParameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, RoutingRule routingRuleParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - public static void Delete(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName) - { - operations.DeleteAsync(resourceGroupName, frontDoorName, routingRuleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - public static RoutingRule BeginCreateOrUpdate(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, RoutingRule routingRuleParameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters).GetAwaiter().GetResult(); - } - - /// - /// Creates a new Routing Rule with the specified Rule name within the - /// specified Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// Routing Rule properties needed to create a new Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, RoutingRule routingRuleParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, routingRuleParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - public static void BeginDelete(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName) - { - operations.BeginDeleteAsync(resourceGroupName, frontDoorName, routingRuleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an existing Routing Rule with the specified parameters. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the Resource group within the Azure subscription. - /// - /// - /// Name of the Front Door which is globally unique. - /// - /// - /// Name of the Routing Rule which is unique within the Front Door. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IRoutingRulesOperations operations, string resourceGroupName, string frontDoorName, string routingRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, frontDoorName, routingRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByFrontDoorNext(this IRoutingRulesOperations operations, string nextPageLink) - { - return operations.ListByFrontDoorNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all of the Routing Rules within a Front Door. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByFrontDoorNextAsync(this IRoutingRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByFrontDoorNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/SdkInfo_FrontDoorManagementClient.cs b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/SdkInfo_FrontDoorManagementClient.cs index db24a5925aa0..c8e4a961a860 100644 --- a/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/SdkInfo_FrontDoorManagementClient.cs +++ b/sdk/frontdoor/Microsoft.Azure.Management.FrontDoor/src/Generated/SdkInfo_FrontDoorManagementClient.cs @@ -19,30 +19,28 @@ public static IEnumerable> ApiInfo_FrontDoorManage { return new Tuple[] { - new Tuple("Network", "BackendPools", "2019-05-01"), new Tuple("Network", "CheckFrontDoorNameAvailability", "2019-05-01"), new Tuple("Network", "CheckFrontDoorNameAvailabilityWithSubscription", "2019-05-01"), new Tuple("Network", "Endpoints", "2019-05-01"), + new Tuple("Network", "Experiments", "2019-11-01"), new Tuple("Network", "FrontDoors", "2019-05-01"), new Tuple("Network", "FrontendEndpoints", "2019-05-01"), - new Tuple("Network", "HealthProbeSettings", "2019-05-01"), - new Tuple("Network", "LoadBalancingSettings", "2019-05-01"), - new Tuple("Network", "ManagedRuleSets", "2019-03-01"), - new Tuple("Network", "Policies", "2019-03-01"), - new Tuple("Network", "RoutingRules", "2019-05-01"), + new Tuple("Network", "GetNetworkExperimentProfilesByProfileName", "2019-11-01"), + new Tuple("Network", "ManagedRuleSets", "2019-10-01"), + new Tuple("Network", "Policies", "2019-10-01"), + new Tuple("Network", "PreconfiguredEndpoints", "2019-11-01"), + new Tuple("Network", "Profiles", "2019-11-01"), + new Tuple("Network", "createOrUpdateExperiments", "2019-11-01"), + new Tuple("Network", "createOrUpdateNetworkExperimentProfiles", "2019-11-01"), + new Tuple("Network", "deleteExperiments", "2019-11-01"), + new Tuple("Network", "deleteNetworkExperimentProfiles", "2019-11-01"), + new Tuple("Network", "getExperimentsByExperimentName", "2019-11-01"), + new Tuple("Network", "getLatencyScorecards", "2019-11-01"), + new Tuple("Network", "getTimeseries", "2019-11-01"), + new Tuple("Network", "updateExperimentsByExperimentName", "2019-11-01"), + new Tuple("Network", "updateNetworkExperimentProfilesByProfilesName", "2019-11-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/frontdoor/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\AFD\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "59c5761efb6dae1a0cfb624bc1a054e902a855cf"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -