From 6ae7251e016d7b0281c2464fd66fad487a2e718e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 26 Aug 2024 19:13:21 +0000 Subject: [PATCH] CodeGen from PR 30043 in Azure/azure-rest-api-specs Merge fc2505b7c59e7791dab6550ad2fa0622d3fd868a into 260651b67269ee08d515b2bae9d2e9f9c5732c42 --- .../src/Generated/CertificatesOperations.cs | 1201 +++++++++++ .../CertificatesOperationsExtensions.cs | 335 ++++ .../src/Generated/ConfigurationsOperations.cs | 1466 ++++++++++++++ .../ConfigurationsOperationsExtensions.cs | 399 ++++ .../src/Generated/DeploymentsOperations.cs | 1783 +++++++++++++++++ .../DeploymentsOperationsExtensions.cs | 445 ++++ .../src/Generated/ICertificatesOperations.cs | 214 ++ .../Generated/IConfigurationsOperations.cs | 251 +++ .../src/Generated/IDeploymentsOperations.cs | 289 +++ .../src/Generated/INginxManagementClient.cs | 92 + .../src/Generated/IOperations.cs | 70 + .../src/Generated/Models/ActivationState.cs | 22 + .../src/Generated/Models/AnalysisCreate.cs | 63 + .../Generated/Models/AnalysisCreateConfig.cs | 70 + .../Generated/Models/AnalysisDiagnostic.cs | 120 ++ .../src/Generated/Models/AnalysisResult.cs | 72 + .../Generated/Models/AnalysisResultData.cs | 48 + .../Generated/Models/AutoUpgradeProfile.cs | 65 + .../src/Generated/Models/CreatedByType.cs | 24 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorDetail.cs | 85 + .../Generated/Models/IdentityProperties.cs | 70 + .../src/Generated/Models/IdentityType.cs | 24 + .../src/Generated/Models/NginxCertificate.cs | 78 + .../NginxCertificateErrorResponseBody.cs | 54 + .../Models/NginxCertificateProperties.cs | 94 + .../Generated/Models/NginxConfiguration.cs | 78 + .../Models/NginxConfigurationFile.cs | 52 + .../Models/NginxConfigurationPackage.cs | 54 + .../Models/NginxConfigurationProperties.cs | 80 + .../src/Generated/Models/NginxDeployment.cs | 115 ++ .../Models/NginxDeploymentProperties.cs | 146 ++ ...ginxDeploymentPropertiesNginxAppProtect.cs | 75 + .../NginxDeploymentScalingProperties.cs | 85 + .../Models/NginxDeploymentUpdateParameters.cs | 91 + .../Models/NginxDeploymentUpdateProperties.cs | 102 + ...ploymentUpdatePropertiesNginxAppProtect.cs | 51 + .../Models/NginxDeploymentUserProfile.cs | 69 + .../Models/NginxFrontendIPConfiguration.cs | 56 + .../src/Generated/Models/NginxLogging.cs | 46 + .../NginxNetworkInterfaceConfiguration.cs | 48 + .../Generated/Models/NginxNetworkProfile.cs | 52 + .../Generated/Models/NginxPrivateIPAddress.cs | 61 + .../Models/NginxPrivateIPAllocationMethod.cs | 22 + .../Generated/Models/NginxPublicIPAddress.cs | 46 + .../Generated/Models/NginxStorageAccount.cs | 52 + .../src/Generated/Models/OperationDisplay.cs | 80 + .../src/Generated/Models/OperationResult.cs | 70 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/ProvisioningState.cs | 29 + .../ResourceProviderDefaultErrorResponse.cs | 48 + ...ceProviderDefaultErrorResponseException.cs | 62 + .../src/Generated/Models/ResourceSku.cs | 62 + .../src/Generated/Models/ScaleProfile.cs | 80 + .../Generated/Models/ScaleProfileCapacity.cs | 81 + .../src/Generated/Models/SystemData.cs | 103 + .../Models/UserIdentityProperties.cs | 52 + ...WebApplicationFirewallComponentVersions.cs | 84 + .../Models/WebApplicationFirewallPackage.cs | 79 + .../Models/WebApplicationFirewallSettings.cs | 57 + .../Models/WebApplicationFirewallStatus.cs | 113 ++ .../src/Generated/NginxManagementClient.cs | 375 ++++ .../src/Generated/Operations.cs | 399 ++++ .../src/Generated/OperationsExtensions.cs | 91 + .../SdkInfo_NginxManagementClient.cs | 30 + 65 files changed, 10822 insertions(+) create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperationsExtensions.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperationsExtensions.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperationsExtensions.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ICertificatesOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IConfigurationsOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IDeploymentsOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/INginxManagementClient.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IOperations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ActivationState.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreate.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreateConfig.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisDiagnostic.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResult.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResultData.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AutoUpgradeProfile.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityType.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificate.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateErrorResponseBody.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfiguration.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationFile.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationPackage.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeployment.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentPropertiesNginxAppProtect.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentScalingProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateParameters.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdatePropertiesNginxAppProtect.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUserProfile.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxFrontendIPConfiguration.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxLogging.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkInterfaceConfiguration.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkProfile.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAddress.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAllocationMethod.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPublicIPAddress.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxStorageAccount.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationResult.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/Page.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponseException.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceSku.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfile.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfileCapacity.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/SystemData.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/UserIdentityProperties.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallComponentVersions.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallPackage.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallSettings.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallStatus.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/NginxManagementClient.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Operations.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/OperationsExtensions.cs create mode 100644 sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/SdkInfo_NginxManagementClient.cs diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperations.cs new file mode 100644 index 0000000000000..fd74faabdacaf --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperations.cs @@ -0,0 +1,1201 @@ +// +// 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.Nginx +{ + 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; + + /// + /// CertificatesOperations operations. + /// + internal partial class CertificatesOperations : IServiceOperations, ICertificatesOperations + { + /// + /// Initializes a new instance of the CertificatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CertificatesOperations(NginxManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NginxManagementClient + /// + public NginxManagementClient Client { get; private set; } + + /// + /// Get a certificate of given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// 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 deploymentName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("certificateName", certificateName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all certificates of given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + /// + /// 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 deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("body", body); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + 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(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 != 201) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// 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 deploymentName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("certificateName", certificateName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + 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 != 202 && (int)_statusCode != 204) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// List all certificates of given NGINX deployment + /// + /// + /// 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperationsExtensions.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperationsExtensions.cs new file mode 100644 index 0000000000000..5fb394d7e9fc5 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/CertificatesOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CertificatesOperations. + /// + public static partial class CertificatesOperationsExtensions + { + /// + /// Get a certificate of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + public static NginxCertificate Get(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName) + { + return operations.GetAsync(resourceGroupName, deploymentName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Get a certificate of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + public static NginxCertificate CreateOrUpdate(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, deploymentName, certificateName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + public static void Delete(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName) + { + operations.DeleteAsync(resourceGroupName, deploymentName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all certificates of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + public static IPage List(this ICertificatesOperations operations, string resourceGroupName, string deploymentName) + { + return operations.ListAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult(); + } + + /// + /// List all certificates of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + public static NginxCertificate BeginCreateOrUpdate(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, deploymentName, certificateName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + public static void BeginDelete(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName) + { + operations.BeginDeleteAsync(resourceGroupName, deploymentName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICertificatesOperations operations, string resourceGroupName, string deploymentName, string certificateName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, certificateName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all certificates of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICertificatesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all certificates of given NGINX deployment + /// + /// + /// 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 ICertificatesOperations 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperations.cs new file mode 100644 index 0000000000000..6296d5410ad85 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperations.cs @@ -0,0 +1,1466 @@ +// +// 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.Nginx +{ + 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; + + /// + /// ConfigurationsOperations operations. + /// + internal partial class ConfigurationsOperations : IServiceOperations, IConfigurationsOperations + { + /// + /// Initializes a new instance of the ConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ConfigurationsOperations(NginxManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NginxManagementClient + /// + public NginxManagementClient Client { get; private set; } + + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// Get the NGINX configuration of given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// 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 deploymentName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (configurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("configurationName", configurationName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); + 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Analyze an NGINX configuration without applying it to the NGINXaaS + /// deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// + /// + /// 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> AnalysisWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string configurationName, AnalysisCreateConfig config, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (configurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); + } + if (configurationName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(configurationName, "^[a-z][a-z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "configurationName", "^[a-z][a-z0-9]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (config == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "config"); + } + AnalysisCreate body = default(AnalysisCreate); + if (config != null) + { + body = new AnalysisCreate(); + body.Config = config; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("configurationName", configurationName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Analysis", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); + 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("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) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + /// + /// 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 deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (configurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("configurationName", configurationName); + tracingParameters.Add("body", body); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); + 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(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 != 201) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// 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 deploymentName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (configurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("configurationName", configurationName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); + 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 != 202 && (int)_statusCode != 204) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperationsExtensions.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperationsExtensions.cs new file mode 100644 index 0000000000000..1b8838e7c76ac --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ConfigurationsOperationsExtensions.cs @@ -0,0 +1,399 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ConfigurationsOperations. + /// + public static partial class ConfigurationsOperationsExtensions + { + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + public static IPage List(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName) + { + return operations.ListAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult(); + } + + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the NGINX configuration of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + public static NginxConfiguration Get(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName) + { + return operations.GetAsync(resourceGroupName, deploymentName, configurationName).GetAwaiter().GetResult(); + } + + /// + /// Get the NGINX configuration of given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + public static NginxConfiguration CreateOrUpdate(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, deploymentName, configurationName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + public static void Delete(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName) + { + operations.DeleteAsync(resourceGroupName, deploymentName, configurationName).GetAwaiter().GetResult(); + } + + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Analyze an NGINX configuration without applying it to the NGINXaaS + /// deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// + public static AnalysisResult Analysis(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, AnalysisCreateConfig config) + { + return operations.AnalysisAsync(resourceGroupName, deploymentName, configurationName, config).GetAwaiter().GetResult(); + } + + /// + /// Analyze an NGINX configuration without applying it to the NGINXaaS + /// deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task AnalysisAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, AnalysisCreateConfig config, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AnalysisWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, config, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + public static NginxConfiguration BeginCreateOrUpdate(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, deploymentName, configurationName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + public static void BeginDelete(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName) + { + operations.BeginDeleteAsync(resourceGroupName, deploymentName, configurationName).GetAwaiter().GetResult(); + } + + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to the + /// singleton of NGINX conf + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IConfigurationsOperations operations, string resourceGroupName, string deploymentName, string configurationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, configurationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IConfigurationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// 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 IConfigurationsOperations 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperations.cs new file mode 100644 index 0000000000000..3c81aac4ce63f --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperations.cs @@ -0,0 +1,1783 @@ +// +// 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.Nginx +{ + 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; + + /// + /// DeploymentsOperations operations. + /// + internal partial class DeploymentsOperations : IServiceOperations, IDeploymentsOperations + { + /// + /// Initializes a new instance of the DeploymentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeploymentsOperations(NginxManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NginxManagementClient + /// + public NginxManagementClient Client { get; private set; } + + /// + /// Get the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, NginxDeployment body = default(NginxDeployment), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete the NGINX deployment resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List the NGINX deployments resources + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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/Nginx.NginxPlus/nginxDeployments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// 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 deploymentName, NginxDeployment body = default(NginxDeployment), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("body", body); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + 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(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 != 201) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// Update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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 != 201) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// Delete the NGINX deployment resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentName", deploymentName); + 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/Nginx.NginxPlus/nginxDeployments/{deploymentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + 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 != 202 && (int)_statusCode != 204) + { + var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// List the NGINX deployments resources + /// + /// + /// 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperationsExtensions.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperationsExtensions.cs new file mode 100644 index 0000000000000..7e31584bbf839 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/DeploymentsOperationsExtensions.cs @@ -0,0 +1,445 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeploymentsOperations. + /// + public static partial class DeploymentsOperationsExtensions + { + /// + /// Get the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + public static NginxDeployment Get(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName) + { + return operations.GetAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult(); + } + + /// + /// Get the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + public static NginxDeployment CreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeployment body = default(NginxDeployment)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, deploymentName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeployment body = default(NginxDeployment), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + public static NginxDeployment Update(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters)) + { + return operations.UpdateAsync(resourceGroupName, deploymentName, body).GetAwaiter().GetResult(); + } + + /// + /// Update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the NGINX deployment resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + public static void Delete(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName) + { + operations.DeleteAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult(); + } + + /// + /// Delete the NGINX deployment resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the NGINX deployments resources + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDeploymentsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List the NGINX deployments resources + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDeploymentsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IDeploymentsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDeploymentsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + public static NginxDeployment BeginCreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeployment body = default(NginxDeployment)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, deploymentName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeployment body = default(NginxDeployment), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + public static NginxDeployment BeginUpdate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters)) + { + return operations.BeginUpdateAsync(resourceGroupName, deploymentName, body).GetAwaiter().GetResult(); + } + + /// + /// Update the NGINX deployment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the NGINX deployment resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + public static void BeginDelete(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName) + { + operations.BeginDeleteAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult(); + } + + /// + /// Delete the NGINX deployment resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the NGINX deployments resources + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDeploymentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the NGINX deployments resources + /// + /// + /// 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 IDeploymentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDeploymentsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDeploymentsOperations 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ICertificatesOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ICertificatesOperations.cs new file mode 100644 index 0000000000000..309837203bda1 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/ICertificatesOperations.cs @@ -0,0 +1,214 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CertificatesOperations operations. + /// + public partial interface ICertificatesOperations + { + /// + /// Get a certificate of given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// 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 deploymentName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + /// + /// 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 deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// 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 deploymentName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all certificates of given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the NGINX certificates for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// The certificate + /// + /// + /// 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 deploymentName, string certificateName, NginxCertificate body = default(NginxCertificate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a certificate from the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of certificate + /// + /// + /// 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 deploymentName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all certificates of given NGINX deployment + /// + /// + /// 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IConfigurationsOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IConfigurationsOperations.cs new file mode 100644 index 0000000000000..5dbe38dfb6dde --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IConfigurationsOperations.cs @@ -0,0 +1,251 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ConfigurationsOperations operations. + /// + public partial interface IConfigurationsOperations + { + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the NGINX configuration of given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to + /// the singleton of NGINX conf + /// + /// + /// 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 deploymentName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to + /// the singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + /// + /// 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 deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to + /// the singleton of NGINX conf + /// + /// + /// 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 deploymentName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Analyze an NGINX configuration without applying it to the NGINXaaS + /// deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to + /// the singleton of NGINX conf + /// + /// + /// + /// + /// 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> AnalysisWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string configurationName, AnalysisCreateConfig config, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the NGINX configuration for given NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to + /// the singleton of NGINX conf + /// + /// + /// The NGINX configuration + /// + /// + /// 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 deploymentName, string configurationName, NginxConfiguration body = default(NginxConfiguration), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reset the NGINX configuration of given NGINX deployment to default + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// The name of configuration, only 'default' is supported value due to + /// the singleton of NGINX conf + /// + /// + /// 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 deploymentName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the NGINX configuration of given NGINX deployment. + /// + /// + /// 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IDeploymentsOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IDeploymentsOperations.cs new file mode 100644 index 0000000000000..d8a5792e3ab7a --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IDeploymentsOperations.cs @@ -0,0 +1,289 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeploymentsOperations operations. + /// + public partial interface IDeploymentsOperations + { + /// + /// Get the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// 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 deploymentName, NginxDeployment body = default(NginxDeployment), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the NGINX deployment resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the NGINX deployments resources + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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)); + /// + /// Create or update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// 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 deploymentName, NginxDeployment body = default(NginxDeployment), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the NGINX deployment + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, NginxDeploymentUpdateParameters body = default(NginxDeploymentUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the NGINX deployment resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of targeted NGINX deployment + /// + /// + /// 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 deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the NGINX deployments resources + /// + /// + /// 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)); + /// + /// List all NGINX deployments under the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/INginxManagementClient.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/INginxManagementClient.cs new file mode 100644 index 0000000000000..c5ecc5d73615f --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/INginxManagementClient.cs @@ -0,0 +1,92 @@ +// +// 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.Nginx +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface INginxManagementClient : 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; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. + /// + 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 ICertificatesOperations. + /// + ICertificatesOperations Certificates { get; } + + /// + /// Gets the IConfigurationsOperations. + /// + IConfigurationsOperations Configurations { get; } + + /// + /// Gets the IDeploymentsOperations. + /// + IDeploymentsOperations Deployments { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IOperations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..eea294fb51066 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/IOperations.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.Nginx +{ + 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 + { + /// + /// List all operations provided by Nginx.NginxPlus for the + /// 2024-06-01-preview api version. + /// + /// + /// 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)); + /// + /// List all operations provided by Nginx.NginxPlus for the + /// 2024-06-01-preview api version. + /// + /// + /// 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ActivationState.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ActivationState.cs new file mode 100644 index 0000000000000..c61901ee57e73 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ActivationState.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.Nginx.Models +{ + + /// + /// Defines values for ActivationState. + /// + public static class ActivationState + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreate.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreate.cs new file mode 100644 index 0000000000000..4fb8a49745abe --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreate.cs @@ -0,0 +1,63 @@ +// +// 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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The request body for creating an analysis for an NGINX configuration. + /// + public partial class AnalysisCreate + { + /// + /// Initializes a new instance of the AnalysisCreate class. + /// + public AnalysisCreate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AnalysisCreate class. + /// + public AnalysisCreate(AnalysisCreateConfig config) + { + Config = config; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "config")] + public AnalysisCreateConfig Config { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Config == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Config"); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreateConfig.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreateConfig.cs new file mode 100644 index 0000000000000..f73fcc01cf9bd --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisCreateConfig.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class AnalysisCreateConfig + { + /// + /// Initializes a new instance of the AnalysisCreateConfig class. + /// + public AnalysisCreateConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AnalysisCreateConfig class. + /// + /// The root file of the NGINX config file(s). + /// It must match one of the files' filepath. + public AnalysisCreateConfig(string rootFile = default(string), IList files = default(IList), IList protectedFiles = default(IList), NginxConfigurationPackage package = default(NginxConfigurationPackage)) + { + RootFile = rootFile; + Files = files; + ProtectedFiles = protectedFiles; + Package = package; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the root file of the NGINX config file(s). It must + /// match one of the files' filepath. + /// + [JsonProperty(PropertyName = "rootFile")] + public string RootFile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "files")] + public IList Files { get; set; } + + /// + /// + [JsonProperty(PropertyName = "protectedFiles")] + public IList ProtectedFiles { get; set; } + + /// + /// + [JsonProperty(PropertyName = "package")] + public NginxConfigurationPackage Package { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisDiagnostic.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisDiagnostic.cs new file mode 100644 index 0000000000000..bcba75e5f7b96 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisDiagnostic.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An error object found during the analysis of an NGINX configuration. + /// + public partial class AnalysisDiagnostic + { + /// + /// Initializes a new instance of the AnalysisDiagnostic class. + /// + public AnalysisDiagnostic() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AnalysisDiagnostic class. + /// + /// the filepath of the most relevant config + /// file + /// Unique identifier for the error + public AnalysisDiagnostic(string directive, string description, string file, double line, string message, string rule, string id = default(string)) + { + Id = id; + Directive = directive; + Description = description; + File = file; + Line = line; + Message = message; + Rule = rule; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique identifier for the error + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "directive")] + public string Directive { get; set; } + + /// + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the filepath of the most relevant config file + /// + [JsonProperty(PropertyName = "file")] + public string File { get; set; } + + /// + /// + [JsonProperty(PropertyName = "line")] + public double Line { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "rule")] + public string Rule { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Directive == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Directive"); + } + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (File == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "File"); + } + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + if (Rule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Rule"); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResult.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResult.cs new file mode 100644 index 0000000000000..c0a57713e89e7 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResult.cs @@ -0,0 +1,72 @@ +// +// 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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The response body for an analysis request. Contains the status of the + /// analysis and any errors. + /// + public partial class AnalysisResult + { + /// + /// Initializes a new instance of the AnalysisResult class. + /// + public AnalysisResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AnalysisResult class. + /// + /// The status of the analysis. + public AnalysisResult(string status, AnalysisResultData data = default(AnalysisResultData)) + { + Status = status; + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status of the analysis. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// + [JsonProperty(PropertyName = "data")] + public AnalysisResultData Data { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResultData.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResultData.cs new file mode 100644 index 0000000000000..3c17888599590 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AnalysisResultData.cs @@ -0,0 +1,48 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class AnalysisResultData + { + /// + /// Initializes a new instance of the AnalysisResultData class. + /// + public AnalysisResultData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AnalysisResultData class. + /// + public AnalysisResultData(IList errors = default(IList)) + { + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AutoUpgradeProfile.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AutoUpgradeProfile.cs new file mode 100644 index 0000000000000..42e33e9ca3259 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/AutoUpgradeProfile.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Autoupgrade settings of a deployment. + /// + public partial class AutoUpgradeProfile + { + /// + /// Initializes a new instance of the AutoUpgradeProfile class. + /// + public AutoUpgradeProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoUpgradeProfile class. + /// + /// Channel used for autoupgrade. + public AutoUpgradeProfile(string upgradeChannel) + { + UpgradeChannel = upgradeChannel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets channel used for autoupgrade. + /// + [JsonProperty(PropertyName = "upgradeChannel")] + public string UpgradeChannel { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UpgradeChannel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UpgradeChannel"); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/CreatedByType.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..0c8901a74fcbf --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/CreatedByType.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.Nginx.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..2c4b1ca987b24 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorAdditionalInfo.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorDetail.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..753a82b7e6d8c --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ErrorDetail.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityProperties.cs new file mode 100644 index 0000000000000..a68be630c774b --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityProperties.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class IdentityProperties + { + /// + /// Initializes a new instance of the IdentityProperties class. + /// + public IdentityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdentityProperties class. + /// + /// Possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + public IdentityProperties(string principalId = default(string), string tenantId = default(string), string type = default(string), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityType.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityType.cs new file mode 100644 index 0000000000000..a8b9b6e4b3710 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/IdentityType.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.Nginx.Models +{ + + /// + /// Defines values for IdentityType. + /// + public static class IdentityType + { + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned, UserAssigned"; + public const string None = "None"; + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificate.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificate.cs new file mode 100644 index 0000000000000..af6c4263fcba7 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificate.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.Nginx.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxCertificate : IResource + { + /// + /// Initializes a new instance of the NginxCertificate class. + /// + public NginxCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxCertificate class. + /// + public NginxCertificate(string id = default(string), string name = default(string), string type = default(string), NginxCertificateProperties properties = default(NginxCertificateProperties), string location = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + Location = location; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public NginxCertificateProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateErrorResponseBody.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateErrorResponseBody.cs new file mode 100644 index 0000000000000..c665ec89869bb --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateErrorResponseBody.cs @@ -0,0 +1,54 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxCertificateErrorResponseBody + { + /// + /// Initializes a new instance of the NginxCertificateErrorResponseBody + /// class. + /// + public NginxCertificateErrorResponseBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxCertificateErrorResponseBody + /// class. + /// + public NginxCertificateErrorResponseBody(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateProperties.cs new file mode 100644 index 0000000000000..2596f2691b97f --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxCertificateProperties.cs @@ -0,0 +1,94 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxCertificateProperties + { + /// + /// Initializes a new instance of the NginxCertificateProperties class. + /// + public NginxCertificateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxCertificateProperties class. + /// + /// Possible values include: + /// 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + public NginxCertificateProperties(string provisioningState = default(string), string keyVirtualPath = default(string), string certificateVirtualPath = default(string), string keyVaultSecretId = default(string), string sha1Thumbprint = default(string), string keyVaultSecretVersion = default(string), System.DateTime? keyVaultSecretCreated = default(System.DateTime?), NginxCertificateErrorResponseBody certificateError = default(NginxCertificateErrorResponseBody)) + { + ProvisioningState = provisioningState; + KeyVirtualPath = keyVirtualPath; + CertificateVirtualPath = certificateVirtualPath; + KeyVaultSecretId = keyVaultSecretId; + Sha1Thumbprint = sha1Thumbprint; + KeyVaultSecretVersion = keyVaultSecretVersion; + KeyVaultSecretCreated = keyVaultSecretCreated; + CertificateError = certificateError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', + /// 'Deleted', 'NotSpecified' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// + [JsonProperty(PropertyName = "keyVirtualPath")] + public string KeyVirtualPath { get; set; } + + /// + /// + [JsonProperty(PropertyName = "certificateVirtualPath")] + public string CertificateVirtualPath { get; set; } + + /// + /// + [JsonProperty(PropertyName = "keyVaultSecretId")] + public string KeyVaultSecretId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sha1Thumbprint")] + public string Sha1Thumbprint { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "keyVaultSecretVersion")] + public string KeyVaultSecretVersion { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "keyVaultSecretCreated")] + public System.DateTime? KeyVaultSecretCreated { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "certificateError")] + public NginxCertificateErrorResponseBody CertificateError { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfiguration.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfiguration.cs new file mode 100644 index 0000000000000..42a7262150a90 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfiguration.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.Nginx.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxConfiguration : IResource + { + /// + /// Initializes a new instance of the NginxConfiguration class. + /// + public NginxConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxConfiguration class. + /// + public NginxConfiguration(string id = default(string), string name = default(string), string type = default(string), NginxConfigurationProperties properties = default(NginxConfigurationProperties), string location = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + Location = location; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public NginxConfigurationProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationFile.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationFile.cs new file mode 100644 index 0000000000000..9985cc0092bdd --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationFile.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxConfigurationFile + { + /// + /// Initializes a new instance of the NginxConfigurationFile class. + /// + public NginxConfigurationFile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxConfigurationFile class. + /// + public NginxConfigurationFile(string content = default(string), string virtualPath = default(string)) + { + Content = content; + VirtualPath = virtualPath; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + /// + /// + [JsonProperty(PropertyName = "virtualPath")] + public string VirtualPath { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationPackage.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationPackage.cs new file mode 100644 index 0000000000000..aac007fcfea78 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationPackage.cs @@ -0,0 +1,54 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class NginxConfigurationPackage + { + /// + /// Initializes a new instance of the NginxConfigurationPackage class. + /// + public NginxConfigurationPackage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxConfigurationPackage class. + /// + public NginxConfigurationPackage(string data = default(string), IList protectedFiles = default(IList)) + { + Data = data; + ProtectedFiles = protectedFiles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "data")] + public string Data { get; set; } + + /// + /// + [JsonProperty(PropertyName = "protectedFiles")] + public IList ProtectedFiles { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationProperties.cs new file mode 100644 index 0000000000000..e9b9fd3a667a5 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxConfigurationProperties.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class NginxConfigurationProperties + { + /// + /// Initializes a new instance of the NginxConfigurationProperties + /// class. + /// + public NginxConfigurationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxConfigurationProperties + /// class. + /// + /// Possible values include: + /// 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + public NginxConfigurationProperties(string provisioningState = default(string), IList files = default(IList), IList protectedFiles = default(IList), NginxConfigurationPackage package = default(NginxConfigurationPackage), string rootFile = default(string)) + { + ProvisioningState = provisioningState; + Files = files; + ProtectedFiles = protectedFiles; + Package = package; + RootFile = rootFile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', + /// 'Deleted', 'NotSpecified' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// + [JsonProperty(PropertyName = "files")] + public IList Files { get; set; } + + /// + /// + [JsonProperty(PropertyName = "protectedFiles")] + public IList ProtectedFiles { get; set; } + + /// + /// + [JsonProperty(PropertyName = "package")] + public NginxConfigurationPackage Package { get; set; } + + /// + /// + [JsonProperty(PropertyName = "rootFile")] + public string RootFile { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeployment.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeployment.cs new file mode 100644 index 0000000000000..2496f6b68ce08 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeployment.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class NginxDeployment : IResource + { + /// + /// Initializes a new instance of the NginxDeployment class. + /// + public NginxDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxDeployment class. + /// + public NginxDeployment(string id = default(string), string name = default(string), string type = default(string), IdentityProperties identity = default(IdentityProperties), NginxDeploymentProperties properties = default(NginxDeploymentProperties), IDictionary tags = default(IDictionary), ResourceSku sku = default(ResourceSku), string location = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Identity = identity; + Properties = properties; + Tags = tags; + Sku = sku; + Location = location; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public NginxDeploymentProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public ResourceSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + if (Sku != null) + { + Sku.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentProperties.cs new file mode 100644 index 0000000000000..04e78147861ad --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentProperties.cs @@ -0,0 +1,146 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxDeploymentProperties + { + /// + /// Initializes a new instance of the NginxDeploymentProperties class. + /// + public NginxDeploymentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxDeploymentProperties class. + /// + /// Possible values include: + /// 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + /// The managed resource group to + /// deploy VNet injection related network resources. + /// The IP address of the deployment. + /// Settings for NGINX App Protect + /// (NAP) + public NginxDeploymentProperties(string provisioningState = default(string), string nginxVersion = default(string), string managedResourceGroup = default(string), NginxNetworkProfile networkProfile = default(NginxNetworkProfile), string ipAddress = default(string), bool? enableDiagnosticsSupport = default(bool?), NginxLogging logging = default(NginxLogging), NginxDeploymentScalingProperties scalingProperties = default(NginxDeploymentScalingProperties), AutoUpgradeProfile autoUpgradeProfile = default(AutoUpgradeProfile), NginxDeploymentUserProfile userProfile = default(NginxDeploymentUserProfile), NginxDeploymentPropertiesNginxAppProtect nginxAppProtect = default(NginxDeploymentPropertiesNginxAppProtect)) + { + ProvisioningState = provisioningState; + NginxVersion = nginxVersion; + ManagedResourceGroup = managedResourceGroup; + NetworkProfile = networkProfile; + IpAddress = ipAddress; + EnableDiagnosticsSupport = enableDiagnosticsSupport; + Logging = logging; + ScalingProperties = scalingProperties; + AutoUpgradeProfile = autoUpgradeProfile; + UserProfile = userProfile; + NginxAppProtect = nginxAppProtect; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', + /// 'Deleted', 'NotSpecified' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// + [JsonProperty(PropertyName = "nginxVersion")] + public string NginxVersion { get; private set; } + + /// + /// Gets or sets the managed resource group to deploy VNet injection + /// related network resources. + /// + [JsonProperty(PropertyName = "managedResourceGroup")] + public string ManagedResourceGroup { get; set; } + + /// + /// + [JsonProperty(PropertyName = "networkProfile")] + public NginxNetworkProfile NetworkProfile { get; set; } + + /// + /// Gets the IP address of the deployment. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "enableDiagnosticsSupport")] + public bool? EnableDiagnosticsSupport { get; set; } + + /// + /// + [JsonProperty(PropertyName = "logging")] + public NginxLogging Logging { get; set; } + + /// + /// + [JsonProperty(PropertyName = "scalingProperties")] + public NginxDeploymentScalingProperties ScalingProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "autoUpgradeProfile")] + public AutoUpgradeProfile AutoUpgradeProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userProfile")] + public NginxDeploymentUserProfile UserProfile { get; set; } + + /// + /// Gets or sets settings for NGINX App Protect (NAP) + /// + [JsonProperty(PropertyName = "nginxAppProtect")] + public NginxDeploymentPropertiesNginxAppProtect NginxAppProtect { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ScalingProperties != null) + { + ScalingProperties.Validate(); + } + if (AutoUpgradeProfile != null) + { + AutoUpgradeProfile.Validate(); + } + if (UserProfile != null) + { + UserProfile.Validate(); + } + if (NginxAppProtect != null) + { + NginxAppProtect.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentPropertiesNginxAppProtect.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentPropertiesNginxAppProtect.cs new file mode 100644 index 0000000000000..00cc490600327 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentPropertiesNginxAppProtect.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings for NGINX App Protect (NAP) + /// + public partial class NginxDeploymentPropertiesNginxAppProtect + { + /// + /// Initializes a new instance of the + /// NginxDeploymentPropertiesNginxAppProtect class. + /// + public NginxDeploymentPropertiesNginxAppProtect() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// NginxDeploymentPropertiesNginxAppProtect class. + /// + public NginxDeploymentPropertiesNginxAppProtect(WebApplicationFirewallSettings webApplicationFirewallSettings, WebApplicationFirewallStatus webApplicationFirewallStatus = default(WebApplicationFirewallStatus)) + { + WebApplicationFirewallSettings = webApplicationFirewallSettings; + WebApplicationFirewallStatus = webApplicationFirewallStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "webApplicationFirewallSettings")] + public WebApplicationFirewallSettings WebApplicationFirewallSettings { get; set; } + + /// + /// + [JsonProperty(PropertyName = "webApplicationFirewallStatus")] + public WebApplicationFirewallStatus WebApplicationFirewallStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WebApplicationFirewallSettings == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WebApplicationFirewallSettings"); + } + if (WebApplicationFirewallStatus != null) + { + WebApplicationFirewallStatus.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentScalingProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentScalingProperties.cs new file mode 100644 index 0000000000000..dbd6f039110ce --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentScalingProperties.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.Nginx.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information on how the deployment will be scaled. + /// + [Rest.Serialization.JsonTransformation] + public partial class NginxDeploymentScalingProperties + { + /// + /// Initializes a new instance of the NginxDeploymentScalingProperties + /// class. + /// + public NginxDeploymentScalingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxDeploymentScalingProperties + /// class. + /// + public NginxDeploymentScalingProperties(IList profiles, int? capacity = default(int?)) + { + Capacity = capacity; + Profiles = profiles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "autoScaleSettings.profiles")] + public IList Profiles { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Profiles == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); + } + if (Profiles != null) + { + foreach (var element in Profiles) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateParameters.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateParameters.cs new file mode 100644 index 0000000000000..22b1de5b515f7 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateParameters.cs @@ -0,0 +1,91 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class NginxDeploymentUpdateParameters + { + /// + /// Initializes a new instance of the NginxDeploymentUpdateParameters + /// class. + /// + public NginxDeploymentUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxDeploymentUpdateParameters + /// class. + /// + public NginxDeploymentUpdateParameters(IdentityProperties identity = default(IdentityProperties), IDictionary tags = default(IDictionary), ResourceSku sku = default(ResourceSku), string location = default(string), NginxDeploymentUpdateProperties properties = default(NginxDeploymentUpdateProperties)) + { + Identity = identity; + Tags = tags; + Sku = sku; + Location = location; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public ResourceSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public NginxDeploymentUpdateProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateProperties.cs new file mode 100644 index 0000000000000..c765a25f19df7 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdateProperties.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxDeploymentUpdateProperties + { + /// + /// Initializes a new instance of the NginxDeploymentUpdateProperties + /// class. + /// + public NginxDeploymentUpdateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxDeploymentUpdateProperties + /// class. + /// + /// Update settings for NGINX App Protect + /// (NAP) + public NginxDeploymentUpdateProperties(bool? enableDiagnosticsSupport = default(bool?), NginxLogging logging = default(NginxLogging), NginxDeploymentScalingProperties scalingProperties = default(NginxDeploymentScalingProperties), NginxDeploymentUserProfile userProfile = default(NginxDeploymentUserProfile), AutoUpgradeProfile autoUpgradeProfile = default(AutoUpgradeProfile), NginxDeploymentUpdatePropertiesNginxAppProtect nginxAppProtect = default(NginxDeploymentUpdatePropertiesNginxAppProtect)) + { + EnableDiagnosticsSupport = enableDiagnosticsSupport; + Logging = logging; + ScalingProperties = scalingProperties; + UserProfile = userProfile; + AutoUpgradeProfile = autoUpgradeProfile; + NginxAppProtect = nginxAppProtect; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "enableDiagnosticsSupport")] + public bool? EnableDiagnosticsSupport { get; set; } + + /// + /// + [JsonProperty(PropertyName = "logging")] + public NginxLogging Logging { get; set; } + + /// + /// + [JsonProperty(PropertyName = "scalingProperties")] + public NginxDeploymentScalingProperties ScalingProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userProfile")] + public NginxDeploymentUserProfile UserProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "autoUpgradeProfile")] + public AutoUpgradeProfile AutoUpgradeProfile { get; set; } + + /// + /// Gets or sets update settings for NGINX App Protect (NAP) + /// + [JsonProperty(PropertyName = "nginxAppProtect")] + public NginxDeploymentUpdatePropertiesNginxAppProtect NginxAppProtect { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ScalingProperties != null) + { + ScalingProperties.Validate(); + } + if (UserProfile != null) + { + UserProfile.Validate(); + } + if (AutoUpgradeProfile != null) + { + AutoUpgradeProfile.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdatePropertiesNginxAppProtect.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdatePropertiesNginxAppProtect.cs new file mode 100644 index 0000000000000..07af96e536634 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUpdatePropertiesNginxAppProtect.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Update settings for NGINX App Protect (NAP) + /// + public partial class NginxDeploymentUpdatePropertiesNginxAppProtect + { + /// + /// Initializes a new instance of the + /// NginxDeploymentUpdatePropertiesNginxAppProtect class. + /// + public NginxDeploymentUpdatePropertiesNginxAppProtect() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// NginxDeploymentUpdatePropertiesNginxAppProtect class. + /// + public NginxDeploymentUpdatePropertiesNginxAppProtect(WebApplicationFirewallSettings webApplicationFirewallSettings = default(WebApplicationFirewallSettings)) + { + WebApplicationFirewallSettings = webApplicationFirewallSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "webApplicationFirewallSettings")] + public WebApplicationFirewallSettings WebApplicationFirewallSettings { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUserProfile.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUserProfile.cs new file mode 100644 index 0000000000000..6f6ea47ffcd99 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxDeploymentUserProfile.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxDeploymentUserProfile + { + /// + /// Initializes a new instance of the NginxDeploymentUserProfile class. + /// + public NginxDeploymentUserProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxDeploymentUserProfile class. + /// + /// The preferred support contact email + /// address of the user used for sending alerts and notification. Can + /// be an empty string or a valid email address. + public NginxDeploymentUserProfile(string preferredEmail = default(string)) + { + PreferredEmail = preferredEmail; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the preferred support contact email address of the + /// user used for sending alerts and notification. Can be an empty + /// string or a valid email address. + /// + [JsonProperty(PropertyName = "preferredEmail")] + public string PreferredEmail { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PreferredEmail != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(PreferredEmail, "^$|^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$")) + { + throw new ValidationException(ValidationRules.Pattern, "PreferredEmail", "^$|^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$"); + } + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxFrontendIPConfiguration.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxFrontendIPConfiguration.cs new file mode 100644 index 0000000000000..9b34ad3876744 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxFrontendIPConfiguration.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class NginxFrontendIPConfiguration + { + /// + /// Initializes a new instance of the NginxFrontendIPConfiguration + /// class. + /// + public NginxFrontendIPConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxFrontendIPConfiguration + /// class. + /// + public NginxFrontendIPConfiguration(IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList)) + { + PublicIPAddresses = publicIPAddresses; + PrivateIPAddresses = privateIPAddresses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "publicIPAddresses")] + public IList PublicIPAddresses { get; set; } + + /// + /// + [JsonProperty(PropertyName = "privateIPAddresses")] + public IList PrivateIPAddresses { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxLogging.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxLogging.cs new file mode 100644 index 0000000000000..2c727569e8fab --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxLogging.cs @@ -0,0 +1,46 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxLogging + { + /// + /// Initializes a new instance of the NginxLogging class. + /// + public NginxLogging() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxLogging class. + /// + public NginxLogging(NginxStorageAccount storageAccount = default(NginxStorageAccount)) + { + StorageAccount = storageAccount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "storageAccount")] + public NginxStorageAccount StorageAccount { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkInterfaceConfiguration.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkInterfaceConfiguration.cs new file mode 100644 index 0000000000000..a66fd162a0a03 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkInterfaceConfiguration.cs @@ -0,0 +1,48 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxNetworkInterfaceConfiguration + { + /// + /// Initializes a new instance of the + /// NginxNetworkInterfaceConfiguration class. + /// + public NginxNetworkInterfaceConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// NginxNetworkInterfaceConfiguration class. + /// + public NginxNetworkInterfaceConfiguration(string subnetId = default(string)) + { + SubnetId = subnetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkProfile.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkProfile.cs new file mode 100644 index 0000000000000..39e5af3e5356f --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxNetworkProfile.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxNetworkProfile + { + /// + /// Initializes a new instance of the NginxNetworkProfile class. + /// + public NginxNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxNetworkProfile class. + /// + public NginxNetworkProfile(NginxFrontendIPConfiguration frontEndIPConfiguration = default(NginxFrontendIPConfiguration), NginxNetworkInterfaceConfiguration networkInterfaceConfiguration = default(NginxNetworkInterfaceConfiguration)) + { + FrontEndIPConfiguration = frontEndIPConfiguration; + NetworkInterfaceConfiguration = networkInterfaceConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "frontEndIPConfiguration")] + public NginxFrontendIPConfiguration FrontEndIPConfiguration { get; set; } + + /// + /// + [JsonProperty(PropertyName = "networkInterfaceConfiguration")] + public NginxNetworkInterfaceConfiguration NetworkInterfaceConfiguration { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAddress.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAddress.cs new file mode 100644 index 0000000000000..f8e4083870ee8 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAddress.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxPrivateIPAddress + { + /// + /// Initializes a new instance of the NginxPrivateIPAddress class. + /// + public NginxPrivateIPAddress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxPrivateIPAddress class. + /// + /// Possible values include: + /// 'Static', 'Dynamic' + public NginxPrivateIPAddress(string privateIPAddress = default(string), string privateIPAllocationMethod = default(string), string subnetId = default(string)) + { + PrivateIPAddress = privateIPAddress; + PrivateIPAllocationMethod = privateIPAllocationMethod; + SubnetId = subnetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "privateIPAddress")] + public string PrivateIPAddress { get; set; } + + /// + /// Gets or sets possible values include: 'Static', 'Dynamic' + /// + [JsonProperty(PropertyName = "privateIPAllocationMethod")] + public string PrivateIPAllocationMethod { get; set; } + + /// + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAllocationMethod.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAllocationMethod.cs new file mode 100644 index 0000000000000..c69cff4531214 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPrivateIPAllocationMethod.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.Nginx.Models +{ + + /// + /// Defines values for NginxPrivateIPAllocationMethod. + /// + public static class NginxPrivateIPAllocationMethod + { + public const string Static = "Static"; + public const string Dynamic = "Dynamic"; + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPublicIPAddress.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPublicIPAddress.cs new file mode 100644 index 0000000000000..ca0b2769c89db --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxPublicIPAddress.cs @@ -0,0 +1,46 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxPublicIPAddress + { + /// + /// Initializes a new instance of the NginxPublicIPAddress class. + /// + public NginxPublicIPAddress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxPublicIPAddress class. + /// + public NginxPublicIPAddress(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxStorageAccount.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxStorageAccount.cs new file mode 100644 index 0000000000000..26fa42fb75afa --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/NginxStorageAccount.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NginxStorageAccount + { + /// + /// Initializes a new instance of the NginxStorageAccount class. + /// + public NginxStorageAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NginxStorageAccount class. + /// + public NginxStorageAccount(string accountName = default(string), string containerName = default(string)) + { + AccountName = accountName; + ContainerName = containerName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "containerName")] + public string ContainerName { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationDisplay.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..77f079bc56715 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.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: Nginx.NginxPlus + /// Type on which the operation is performed, + /// e.g., 'deployments'. + /// Operation type, e.g., read, write, delete, + /// etc. + /// Description of the operation, e.g., + /// 'Write deployments'. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service provider: Nginx.NginxPlus + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets type on which the operation is performed, e.g., + /// 'deployments'. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets operation type, e.g., read, write, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets description of the operation, e.g., 'Write + /// deployments'. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationResult.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationResult.cs new file mode 100644 index 0000000000000..36d1ff5fdad1c --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/OperationResult.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Nginx.NginxPlus REST API operation. + /// + public partial class OperationResult + { + /// + /// Initializes a new instance of the OperationResult class. + /// + public OperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResult class. + /// + /// Operation name: + /// {provider}/{resource}/{operation} + /// The object that represents the + /// operation. + /// Indicates whether the operation is a + /// data action + public OperationResult(string name = default(string), OperationDisplay display = default(OperationDisplay), bool? isDataAction = default(bool?)) + { + Name = name; + Display = display; + IsDataAction = isDataAction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/Page.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..740840e100a7d --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/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.Nginx.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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ProvisioningState.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..edb1d5c6ae860 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Accepted = "Accepted"; + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Deleted = "Deleted"; + public const string NotSpecified = "NotSpecified"; + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs new file mode 100644 index 0000000000000..714bcc31d1ff2 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs @@ -0,0 +1,48 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ResourceProviderDefaultErrorResponse + { + /// + /// Initializes a new instance of the + /// ResourceProviderDefaultErrorResponse class. + /// + public ResourceProviderDefaultErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceProviderDefaultErrorResponse class. + /// + public ResourceProviderDefaultErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponseException.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponseException.cs new file mode 100644 index 0000000000000..c7e5ee3fb5cc1 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceProviderDefaultErrorResponseException.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.Nginx.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with + /// ResourceProviderDefaultErrorResponse information. + /// + public partial class ResourceProviderDefaultErrorResponseException : 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 ResourceProviderDefaultErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ResourceProviderDefaultErrorResponseException class. + /// + public ResourceProviderDefaultErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ResourceProviderDefaultErrorResponseException class. + /// + /// The exception message. + public ResourceProviderDefaultErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ResourceProviderDefaultErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ResourceProviderDefaultErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceSku.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceSku.cs new file mode 100644 index 0000000000000..5979d20a05527 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ResourceSku.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class ResourceSku + { + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSku class. + /// + /// Name of the SKU. + public ResourceSku(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the SKU. + /// + [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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfile.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfile.cs new file mode 100644 index 0000000000000..cca7b358a0341 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfile.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The autoscale profile. + /// + public partial class ScaleProfile + { + /// + /// Initializes a new instance of the ScaleProfile class. + /// + public ScaleProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleProfile class. + /// + /// The capacity parameters of the + /// profile. + public ScaleProfile(string name, ScaleProfileCapacity capacity) + { + Name = name; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the capacity parameters of the profile. + /// + [JsonProperty(PropertyName = "capacity")] + public ScaleProfileCapacity Capacity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Capacity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Capacity"); + } + if (Capacity != null) + { + Capacity.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfileCapacity.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfileCapacity.cs new file mode 100644 index 0000000000000..1fc56b439d530 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/ScaleProfileCapacity.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The capacity parameters of the profile. + /// + public partial class ScaleProfileCapacity + { + /// + /// Initializes a new instance of the ScaleProfileCapacity class. + /// + public ScaleProfileCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleProfileCapacity class. + /// + /// The minimum number of NCUs the deployment can be + /// autoscaled to. + /// The maximum number of NCUs the deployment can be + /// autoscaled to. + public ScaleProfileCapacity(int min, int max) + { + Min = min; + Max = max; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum number of NCUs the deployment can be + /// autoscaled to. + /// + [JsonProperty(PropertyName = "min")] + public int Min { get; set; } + + /// + /// Gets or sets the maximum number of NCUs the deployment can be + /// autoscaled to. + /// + [JsonProperty(PropertyName = "max")] + public int Max { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Min < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Min", 0); + } + if (Max < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/SystemData.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..235ff5a6dd594 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/SystemData.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/UserIdentityProperties.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/UserIdentityProperties.cs new file mode 100644 index 0000000000000..179c8a6a33553 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/UserIdentityProperties.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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class UserIdentityProperties + { + /// + /// Initializes a new instance of the UserIdentityProperties class. + /// + public UserIdentityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentityProperties class. + /// + public UserIdentityProperties(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallComponentVersions.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallComponentVersions.cs new file mode 100644 index 0000000000000..6833e4232abd9 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallComponentVersions.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Versions of the NGINX App Protect Web Application Firewall (WAF) + /// components. + /// + public partial class WebApplicationFirewallComponentVersions + { + /// + /// Initializes a new instance of the + /// WebApplicationFirewallComponentVersions class. + /// + public WebApplicationFirewallComponentVersions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// WebApplicationFirewallComponentVersions class. + /// + /// The version of the NGINX App Protect + /// Web Application Firewall (WAF) engine. + /// The version of the NGINX App Protect + /// Web Application Firewall (WAF) module for NGINX. + public WebApplicationFirewallComponentVersions(string wafEngineVersion, string wafNginxVersion) + { + WafEngineVersion = wafEngineVersion; + WafNginxVersion = wafNginxVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the version of the NGINX App Protect Web Application + /// Firewall (WAF) engine. + /// + [JsonProperty(PropertyName = "wafEngineVersion")] + public string WafEngineVersion { get; set; } + + /// + /// Gets or sets the version of the NGINX App Protect Web Application + /// Firewall (WAF) module for NGINX. + /// + [JsonProperty(PropertyName = "wafNginxVersion")] + public string WafNginxVersion { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WafEngineVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WafEngineVersion"); + } + if (WafNginxVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WafNginxVersion"); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallPackage.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallPackage.cs new file mode 100644 index 0000000000000..3eb98807f29c6 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallPackage.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.Nginx.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// NGINX App Protect Web Application Firewall (WAF) Package. Contains the + /// version and revision date of the package. + /// + public partial class WebApplicationFirewallPackage + { + /// + /// Initializes a new instance of the WebApplicationFirewallPackage + /// class. + /// + public WebApplicationFirewallPackage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebApplicationFirewallPackage + /// class. + /// + /// The version of the NGINX App Protect Web + /// Application Firewall (WAF) package. + /// The date and time of the package + /// revision. + public WebApplicationFirewallPackage(string version, System.DateTime revisionDatetime) + { + Version = version; + RevisionDatetime = revisionDatetime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the version of the NGINX App Protect Web Application + /// Firewall (WAF) package. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets the date and time of the package revision. + /// + [JsonProperty(PropertyName = "revisionDatetime")] + public System.DateTime RevisionDatetime { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Version"); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallSettings.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallSettings.cs new file mode 100644 index 0000000000000..270adc55586cc --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallSettings.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings for the NGINX App Protect Web Application Firewall (WAF) + /// + public partial class WebApplicationFirewallSettings + { + /// + /// Initializes a new instance of the WebApplicationFirewallSettings + /// class. + /// + public WebApplicationFirewallSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebApplicationFirewallSettings + /// class. + /// + /// The activation state of the WAF. Use + /// 'Enabled' to enable the WAF and 'Disabled' to disable it. Possible + /// values include: 'Enabled', 'Disabled' + public WebApplicationFirewallSettings(string activationState = default(string)) + { + ActivationState = activationState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the activation state of the WAF. Use 'Enabled' to + /// enable the WAF and 'Disabled' to disable it. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "activationState")] + public string ActivationState { get; set; } + + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallStatus.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallStatus.cs new file mode 100644 index 0000000000000..0896553d33b91 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Models/WebApplicationFirewallStatus.cs @@ -0,0 +1,113 @@ +// +// 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.Nginx.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The status of the NGINX App Protect Web Application Firewall + /// + public partial class WebApplicationFirewallStatus + { + /// + /// Initializes a new instance of the WebApplicationFirewallStatus + /// class. + /// + public WebApplicationFirewallStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebApplicationFirewallStatus + /// class. + /// + /// Package containing attack + /// signatures for the NGINX App Protect Web Application Firewall + /// (WAF). + /// Package containing bot + /// signatures for the NGINX App Protect Web Application Firewall + /// (WAF). + /// Package containing threat + /// campaigns for the NGINX App Protect Web Application Firewall + /// (WAF). + /// Versions of the NGINX App Protect + /// Web Application Firewall (WAF) components. + public WebApplicationFirewallStatus(WebApplicationFirewallPackage attackSignaturesPackage = default(WebApplicationFirewallPackage), WebApplicationFirewallPackage botSignaturesPackage = default(WebApplicationFirewallPackage), WebApplicationFirewallPackage threatCampaignsPackage = default(WebApplicationFirewallPackage), WebApplicationFirewallComponentVersions componentVersions = default(WebApplicationFirewallComponentVersions)) + { + AttackSignaturesPackage = attackSignaturesPackage; + BotSignaturesPackage = botSignaturesPackage; + ThreatCampaignsPackage = threatCampaignsPackage; + ComponentVersions = componentVersions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets package containing attack signatures for the NGINX App Protect + /// Web Application Firewall (WAF). + /// + [JsonProperty(PropertyName = "attackSignaturesPackage")] + public WebApplicationFirewallPackage AttackSignaturesPackage { get; private set; } + + /// + /// Gets package containing bot signatures for the NGINX App Protect + /// Web Application Firewall (WAF). + /// + [JsonProperty(PropertyName = "botSignaturesPackage")] + public WebApplicationFirewallPackage BotSignaturesPackage { get; private set; } + + /// + /// Gets package containing threat campaigns for the NGINX App Protect + /// Web Application Firewall (WAF). + /// + [JsonProperty(PropertyName = "threatCampaignsPackage")] + public WebApplicationFirewallPackage ThreatCampaignsPackage { get; private set; } + + /// + /// Gets versions of the NGINX App Protect Web Application Firewall + /// (WAF) components. + /// + [JsonProperty(PropertyName = "componentVersions")] + public WebApplicationFirewallComponentVersions ComponentVersions { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AttackSignaturesPackage != null) + { + AttackSignaturesPackage.Validate(); + } + if (BotSignaturesPackage != null) + { + BotSignaturesPackage.Validate(); + } + if (ThreatCampaignsPackage != null) + { + ThreatCampaignsPackage.Validate(); + } + if (ComponentVersions != null) + { + ComponentVersions.Validate(); + } + } + } +} diff --git a/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/NginxManagementClient.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/NginxManagementClient.cs new file mode 100644 index 0000000000000..187937edf4ddb --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/NginxManagementClient.cs @@ -0,0 +1,375 @@ +// +// 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.Nginx +{ + 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 NginxManagementClient : ServiceClient, INginxManagementClient, 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; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The ID of the target subscription. + /// + 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 ICertificatesOperations. + /// + public virtual ICertificatesOperations Certificates { get; private set; } + + /// + /// Gets the IConfigurationsOperations. + /// + public virtual IConfigurationsOperations Configurations { get; private set; } + + /// + /// Gets the IDeploymentsOperations. + /// + public virtual IDeploymentsOperations Deployments { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the NginxManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling NginxManagementClient.Dispose(). False: will not dispose provided httpClient + protected NginxManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the NginxManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected NginxManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the NginxManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected NginxManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the NginxManagementClient 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 NginxManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the NginxManagementClient 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 NginxManagementClient(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 NginxManagementClient 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 NginxManagementClient(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 NginxManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling NginxManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public NginxManagementClient(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 NginxManagementClient 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 NginxManagementClient(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 NginxManagementClient 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 NginxManagementClient(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 NginxManagementClient 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 NginxManagementClient(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() + { + Certificates = new CertificatesOperations(this); + Configurations = new ConfigurationsOperations(this); + Deployments = new DeploymentsOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2024-06-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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Operations.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Operations.cs new file mode 100644 index 0000000000000..f3927c22c27dc --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/Operations.cs @@ -0,0 +1,399 @@ +// +// 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.Nginx +{ + 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(NginxManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NginxManagementClient + /// + public NginxManagementClient Client { get; private set; } + + /// + /// List all operations provided by Nginx.NginxPlus for the 2024-06-01-preview + /// api version. + /// + /// + /// 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"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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/Nginx.NginxPlus/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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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; + } + + /// + /// List all operations provided by Nginx.NginxPlus for the 2024-06-01-preview + /// api version. + /// + /// + /// 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ResourceProviderDefaultErrorResponse _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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/OperationsExtensions.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..061caebe066c1 --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/OperationsExtensions.cs @@ -0,0 +1,91 @@ +// +// 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.Nginx +{ + 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 + { + /// + /// List all operations provided by Nginx.NginxPlus for the 2024-06-01-preview + /// api version. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List all operations provided by Nginx.NginxPlus for the 2024-06-01-preview + /// api version. + /// + /// + /// 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; + } + } + + /// + /// List all operations provided by Nginx.NginxPlus for the 2024-06-01-preview + /// api version. + /// + /// + /// 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(); + } + + /// + /// List all operations provided by Nginx.NginxPlus for the 2024-06-01-preview + /// api version. + /// + /// + /// 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/nginx/Microsoft.Azure.Management.Nginx/src/Generated/SdkInfo_NginxManagementClient.cs b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/SdkInfo_NginxManagementClient.cs new file mode 100644 index 0000000000000..ab520b9cf196f --- /dev/null +++ b/sdk/nginx/Microsoft.Azure.Management.Nginx/src/Generated/SdkInfo_NginxManagementClient.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.Nginx +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_NginxManagementClient + { + get + { + return new Tuple[] + { + new Tuple("NginxManagementClient", "Certificates", "2024-06-01-preview"), + new Tuple("NginxManagementClient", "Configurations", "2024-06-01-preview"), + new Tuple("NginxManagementClient", "Deployments", "2024-06-01-preview"), + new Tuple("NginxManagementClient", "Operations", "2024-06-01-preview"), + }.AsEnumerable(); + } + } + } +}