From 0282980dc0fd855d6c333fb0d2f8256535c19647 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 17 Aug 2020 06:08:22 +0000 Subject: [PATCH] Generated from 41967d1de2006725af6634b9ebc7db3ca8e743e5 Update specification/appplatform/resource-manager/readme.go.md Remove "perview" term in output path. Co-authored-by: Arcturus --- .../Generated/AppPlatformManagementClient.cs | 32 +- .../src/Generated/AppsOperations.cs | 406 ++++- .../src/Generated/AppsOperationsExtensions.cs | 115 +- .../src/Generated/BindingsOperations.cs | 295 +++- .../Generated/BindingsOperationsExtensions.cs | 179 ++- .../src/Generated/CertificatesOperations.cs | 1114 +++++++++++++ .../CertificatesOperationsExtensions.cs | 347 ++++ .../src/Generated/ConfigServersOperations.cs | 753 +++++++++ .../ConfigServersOperationsExtensions.cs | 259 +++ .../src/Generated/CustomDomainsOperations.cs | 1427 +++++++++++++++++ .../CustomDomainsOperationsExtensions.cs | 503 ++++++ .../src/Generated/DeploymentsOperations.cs | 431 ++--- .../DeploymentsOperationsExtensions.cs | 83 +- .../Generated/IAppPlatformManagementClient.cs | 25 + .../src/Generated/IAppsOperations.cs | 68 +- .../src/Generated/IBindingsOperations.cs | 106 +- .../src/Generated/ICertificatesOperations.cs | 226 +++ .../src/Generated/IConfigServersOperations.cs | 174 ++ .../src/Generated/ICustomDomainsOperations.cs | 316 ++++ .../src/Generated/IDeploymentsOperations.cs | 42 +- .../IMonitoringSettingsOperations.cs | 174 ++ .../src/Generated/IServicesOperations.cs | 16 +- .../src/Generated/ISkusOperations.cs | 70 + .../src/Generated/Models/AppResource.cs | 21 +- .../Generated/Models/AppResourceProperties.cs | 18 +- .../Models/BindingResourceProperties.cs | 8 +- .../Generated/Models/CertificateProperties.cs | 147 ++ .../Generated/Models/CertificateResource.cs | 70 + .../Models/ClusterResourceProperties.cs | 34 +- .../Models/ConfigServerProperties.cs | 14 +- .../Generated/Models/ConfigServerResource.cs | 70 + .../Models/CustomDomainProperties.cs | 69 + .../Generated/Models/CustomDomainResource.cs | 57 + .../Models/CustomDomainValidatePayload.cs | 67 + .../Models/CustomDomainValidateResult.cs | 60 + .../Generated/Models/DeploymentResource.cs | 19 +- .../Models/DeploymentResourceProperties.cs | 33 +- .../Generated/Models/DeploymentSettings.cs | 57 +- .../Models/ManagedIdentityProperties.cs | 71 + .../Generated/Models/ManagedIdentityType.cs | 24 + .../Models/MonitoringSettingProperties.cs | 83 + .../Models/MonitoringSettingResource.cs | 57 + ...roxyState.cs => MonitoringSettingState.cs} | 4 +- .../src/Generated/Models/NetworkProfile.cs | 93 ++ .../src/Generated/Models/OperationDetail.cs | 12 +- .../src/Generated/Models/ResourceSku.cs | 122 ++ .../Models/ResourceSkuCapabilities.cs | 58 + .../Models/ResourceSkuLocationInfo.cs | 71 + .../Models/ResourceSkuRestrictionInfo.cs | 63 + .../Models/ResourceSkuRestrictions.cs | 88 + .../ResourceSkuRestrictionsReasonCode.cs | 22 + .../Models/ResourceSkuRestrictionsType.cs | 22 + .../Models/ResourceSkuZoneDetails.cs | 67 + .../src/Generated/Models/ServiceResource.cs | 19 +- .../src/Generated/Models/Sku.cs | 68 + .../src/Generated/Models/SkuCapacity.cs | 86 + .../src/Generated/Models/SkuScaleType.cs | 23 + .../src/Generated/Models/TraceProperties.cs | 79 - .../Generated/MonitoringSettingsOperations.cs | 749 +++++++++ .../MonitoringSettingsOperationsExtensions.cs | 259 +++ .../SdkInfo_AppPlatformManagementClient.cs | 26 +- .../src/Generated/ServicesOperations.cs | 76 +- .../Generated/ServicesOperationsExtensions.cs | 32 +- .../src/Generated/SkusOperations.cs | 401 +++++ .../src/Generated/SkusOperationsExtensions.cs | 87 + 65 files changed, 10024 insertions(+), 643 deletions(-) create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperationsExtensions.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperationsExtensions.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperationsExtensions.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICertificatesOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IConfigServersOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICustomDomainsOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IMonitoringSettingsOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ISkusOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateProperties.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateResource.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerResource.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainProperties.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainResource.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidatePayload.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidateResult.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityProperties.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityType.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingProperties.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingResource.cs rename sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/{TraceProxyState.cs => MonitoringSettingState.cs} (87%) create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/NetworkProfile.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSku.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuCapabilities.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuLocationInfo.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionInfo.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictions.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsType.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuZoneDetails.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/Sku.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuCapacity.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuScaleType.cs delete mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProperties.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperationsExtensions.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperations.cs create mode 100644 sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperationsExtensions.cs diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppPlatformManagementClient.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppPlatformManagementClient.cs index 45efe0c1cc27..bd2bce28203f 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppPlatformManagementClient.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppPlatformManagementClient.cs @@ -81,6 +81,16 @@ public partial class AppPlatformManagementClient : ServiceClient public virtual IServicesOperations Services { get; private set; } + /// + /// Gets the IConfigServersOperations. + /// + public virtual IConfigServersOperations ConfigServers { get; private set; } + + /// + /// Gets the IMonitoringSettingsOperations. + /// + public virtual IMonitoringSettingsOperations MonitoringSettings { get; private set; } + /// /// Gets the IAppsOperations. /// @@ -91,6 +101,16 @@ public partial class AppPlatformManagementClient : ServiceClient public virtual IBindingsOperations Bindings { get; private set; } + /// + /// Gets the ICertificatesOperations. + /// + public virtual ICertificatesOperations Certificates { get; private set; } + + /// + /// Gets the ICustomDomainsOperations. + /// + public virtual ICustomDomainsOperations CustomDomains { get; private set; } + /// /// Gets the IDeploymentsOperations. /// @@ -101,6 +121,11 @@ public partial class AppPlatformManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } + /// + /// Gets the ISkusOperations. + /// + public virtual ISkusOperations Skus { get; private set; } + /// /// Initializes a new instance of the AppPlatformManagementClient class. /// @@ -343,12 +368,17 @@ public AppPlatformManagementClient(System.Uri baseUri, ServiceClientCredentials private void Initialize() { Services = new ServicesOperations(this); + ConfigServers = new ConfigServersOperations(this); + MonitoringSettings = new MonitoringSettingsOperations(this); Apps = new AppsOperations(this); Bindings = new BindingsOperations(this); + Certificates = new CertificatesOperations(this); + CustomDomains = new CustomDomainsOperations(this); Deployments = new DeploymentsOperations(this); Operations = new Operations(this); + Skus = new SkusOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-05-01-preview"; + ApiVersion = "2020-07-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperations.cs index df36895e2fe9..af2c7b4cb62b 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperations.cs @@ -112,10 +112,10 @@ internal AppsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("syncStatus", syncStatus); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); + tracingParameters.Add("syncStatus", syncStatus); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -127,14 +127,14 @@ internal AppsOperations(AppPlatformManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); List _queryParameters = new List(); - if (syncStatus != null) - { - _queryParameters.Add(string.Format("syncStatus={0}", System.Uri.EscapeDataString(syncStatus))); - } if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (syncStatus != null) + { + _queryParameters.Add(string.Format("syncStatus={0}", System.Uri.EscapeDataString(syncStatus))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -282,7 +282,7 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, customHeaders, cancellationToken).ConfigureAwait(false); @@ -303,6 +303,58 @@ internal AppsOperations(AppPlatformManagementClient client) /// The name of the App resource. /// /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Operation to update an exiting App. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Handles requests to list all resources in a Service. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// /// Headers that will be added to request. /// /// @@ -311,6 +363,9 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -320,7 +375,7 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -334,10 +389,6 @@ internal AppsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); } - if (appName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appName"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -347,17 +398,15 @@ internal AppsOperations(AppPlatformManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("appName", appName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); - _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -370,7 +419,7 @@ internal AppsOperations(AppPlatformManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -421,7 +470,7 @@ internal AppsOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -456,13 +505,31 @@ internal AppsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -471,7 +538,8 @@ internal AppsOperations(AppPlatformManagementClient client) } /// - /// Operation to update an exiting App. + /// Get an resource upload URL for an App, which may be artifacts or source + /// archive. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -483,32 +551,6 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// The name of the App resource. /// - /// - /// Parameters for the update operation - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Handles requests to list all resources in a Service. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the Service resource. - /// /// /// Headers that will be added to request. /// @@ -530,7 +572,7 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetResourceUploadUrlWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -544,6 +586,10 @@ internal AppsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -553,15 +599,17 @@ internal AppsOperations(AppPlatformManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetResourceUploadUrl", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -574,7 +622,7 @@ internal AppsOperations(AppPlatformManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -660,7 +708,7 @@ internal AppsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -673,7 +721,7 @@ internal AppsOperations(AppPlatformManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -693,8 +741,7 @@ internal AppsOperations(AppPlatformManagementClient client) } /// - /// Get an resource upload URL for an App, which may be artifacts or source - /// archive. + /// Check the resource name is valid as well as not in use. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -706,6 +753,9 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// The name of the App resource. /// + /// + /// Custom domain payload to be validated + /// /// /// Headers that will be added to request. /// @@ -727,7 +777,7 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetResourceUploadUrlWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ValidateDomainWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, CustomDomainValidatePayload validatePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -745,6 +795,14 @@ internal AppsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "appName"); } + if (validatePayload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "validatePayload"); + } + if (validatePayload != null) + { + validatePayload.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -755,12 +813,13 @@ internal AppsOperations(AppPlatformManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); + tracingParameters.Add("validatePayload", validatePayload); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetResourceUploadUrl", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ValidateDomain", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); @@ -808,6 +867,12 @@ internal AppsOperations(AppPlatformManagementClient client) // Serialize Request string _requestContent = null; + if(validatePayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(validatePayload, 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) { @@ -863,7 +928,7 @@ internal AppsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -876,7 +941,7 @@ internal AppsOperations(AppPlatformManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -932,12 +997,8 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appResource != null) - { - appResource.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -954,6 +1015,14 @@ internal AppsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "appName"); } + if (appResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appResource"); + } + if (appResource != null) + { + appResource.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -961,10 +1030,10 @@ internal AppsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appResource", appResource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); + tracingParameters.Add("appResource", appResource); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1044,7 +1113,7 @@ internal AppsOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1122,6 +1191,205 @@ internal AppsOperations(AppPlatformManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Operation to delete an App. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// 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 serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1166,7 +1434,7 @@ internal AppsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1184,6 +1452,10 @@ internal AppsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "appName"); } + if (appResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appResource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1191,10 +1463,10 @@ internal AppsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appResource", appResource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); + tracingParameters.Add("appResource", appResource); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperationsExtensions.cs index 52c356b2e138..1f65f0f65677 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperationsExtensions.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppsOperationsExtensions.cs @@ -94,7 +94,7 @@ public static partial class AppsOperationsExtensions /// /// Parameters for the create or update operation /// - public static AppResource CreateOrUpdate(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource)) + public static AppResource CreateOrUpdate(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource) { return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, appName, appResource).GetAwaiter().GetResult(); } @@ -121,7 +121,7 @@ public static partial class AppsOperationsExtensions /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, null, cancellationToken).ConfigureAwait(false)) { @@ -193,7 +193,7 @@ public static void Delete(this IAppsOperations operations, string resourceGroupN /// /// Parameters for the update operation /// - public static AppResource Update(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource)) + public static AppResource Update(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource) { return operations.UpdateAsync(resourceGroupName, serviceName, appName, appResource).GetAwaiter().GetResult(); } @@ -220,7 +220,7 @@ public static void Delete(this IAppsOperations operations, string resourceGroupN /// /// The cancellation token. /// - public static async Task UpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, null, cancellationToken).ConfigureAwait(false)) { @@ -320,6 +320,60 @@ public static ResourceUploadDefinition GetResourceUploadUrl(this IAppsOperations } } + /// + /// Check the resource name is valid as well as not in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// Custom domain payload to be validated + /// + public static CustomDomainValidateResult ValidateDomain(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, CustomDomainValidatePayload validatePayload) + { + return operations.ValidateDomainAsync(resourceGroupName, serviceName, appName, validatePayload).GetAwaiter().GetResult(); + } + + /// + /// Check the resource name is valid as well as not in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// Custom domain payload to be validated + /// + /// + /// The cancellation token. + /// + public static async Task ValidateDomainAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, CustomDomainValidatePayload validatePayload, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateDomainWithHttpMessagesAsync(resourceGroupName, serviceName, appName, validatePayload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Create a new App or update an exiting App. /// @@ -339,7 +393,7 @@ public static ResourceUploadDefinition GetResourceUploadUrl(this IAppsOperations /// /// Parameters for the create or update operation /// - public static AppResource BeginCreateOrUpdate(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource)) + public static AppResource BeginCreateOrUpdate(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, appResource).GetAwaiter().GetResult(); } @@ -366,7 +420,7 @@ public static ResourceUploadDefinition GetResourceUploadUrl(this IAppsOperations /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, null, cancellationToken).ConfigureAwait(false)) { @@ -374,6 +428,51 @@ public static ResourceUploadDefinition GetResourceUploadUrl(this IAppsOperations } } + /// + /// Operation to delete an App. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + public static void BeginDelete(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName) + { + operations.BeginDeleteAsync(resourceGroupName, serviceName, appName).GetAwaiter().GetResult(); + } + + /// + /// Operation to delete an App. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Operation to update an exiting App. /// @@ -393,7 +492,7 @@ public static ResourceUploadDefinition GetResourceUploadUrl(this IAppsOperations /// /// Parameters for the update operation /// - public static AppResource BeginUpdate(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource)) + public static AppResource BeginUpdate(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource) { return operations.BeginUpdateAsync(resourceGroupName, serviceName, appName, appResource).GetAwaiter().GetResult(); } @@ -420,7 +519,7 @@ public static ResourceUploadDefinition GetResourceUploadUrl(this IAppsOperations /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IAppsOperations operations, string resourceGroupName, string serviceName, string appName, AppResource appResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, appResource, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperations.cs index 384581af1fee..d066132ca686 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperations.cs @@ -281,6 +281,93 @@ internal BindingsOperations(AppPlatformManagementClient client) /// Parameters for the create or update operation /// /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Operation to delete a Binding. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Operation to update an exiting Binding. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Handles requests to list all resources in an App. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// /// Headers that will be added to request. /// /// @@ -301,7 +388,7 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -319,10 +406,6 @@ internal BindingsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "appName"); } - if (bindingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "bindingName"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -330,22 +413,19 @@ internal BindingsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("bindingResource", bindingResource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); - tracingParameters.Add("bindingName", bindingName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); - _url = _url.Replace("{bindingName}", System.Uri.EscapeDataString(bindingName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -358,7 +438,7 @@ internal BindingsOperations(AppPlatformManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -389,12 +469,6 @@ internal BindingsOperations(AppPlatformManagementClient client) // Serialize Request string _requestContent = null; - if(bindingResource != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindingResource, 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) { @@ -450,7 +524,7 @@ internal BindingsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -463,7 +537,7 @@ internal BindingsOperations(AppPlatformManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -483,7 +557,7 @@ internal BindingsOperations(AppPlatformManagementClient client) } /// - /// Operation to delete a Binding. + /// Create a new Binding or update an exiting Binding. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -498,6 +572,9 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// The name of the Binding resource. /// + /// + /// Parameters for the create or update operation + /// /// /// Headers that will be added to request. /// @@ -507,6 +584,9 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -516,7 +596,7 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -538,6 +618,10 @@ internal BindingsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "bindingName"); } + if (bindingResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bindingResource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -549,8 +633,9 @@ internal BindingsOperations(AppPlatformManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); tracingParameters.Add("bindingName", bindingName); + tracingParameters.Add("bindingResource", bindingResource); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -572,7 +657,7 @@ internal BindingsOperations(AppPlatformManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -603,6 +688,12 @@ internal BindingsOperations(AppPlatformManagementClient client) // Serialize Request string _requestContent = null; + if(bindingResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindingResource, 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) { @@ -623,7 +714,7 @@ internal BindingsOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -658,13 +749,67 @@ internal BindingsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -673,7 +818,7 @@ internal BindingsOperations(AppPlatformManagementClient client) } /// - /// Operation to update an exiting Binding. + /// Operation to delete a Binding. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -688,9 +833,6 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// The name of the Binding resource. /// - /// - /// Parameters for the update operation - /// /// /// Headers that will be added to request. /// @@ -700,9 +842,6 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -712,7 +851,7 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -741,13 +880,12 @@ internal BindingsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("bindingResource", bindingResource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); tracingParameters.Add("bindingName", bindingName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -769,7 +907,7 @@ internal BindingsOperations(AppPlatformManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -800,12 +938,6 @@ internal BindingsOperations(AppPlatformManagementClient client) // Serialize Request string _requestContent = null; - if(bindingResource != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindingResource, 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) { @@ -826,7 +958,7 @@ internal BindingsOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -861,31 +993,13 @@ internal BindingsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _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); @@ -894,7 +1008,7 @@ internal BindingsOperations(AppPlatformManagementClient client) } /// - /// Handles requests to list all resources in an App. + /// Operation to update an exiting Binding. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -906,6 +1020,12 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// The name of the App resource. /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the update operation + /// /// /// Headers that will be added to request. /// @@ -927,7 +1047,7 @@ internal BindingsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -945,6 +1065,14 @@ internal BindingsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "appName"); } + if (bindingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bindingName"); + } + if (bindingResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bindingResource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -955,16 +1083,19 @@ internal BindingsOperations(AppPlatformManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); + tracingParameters.Add("bindingName", bindingName); + tracingParameters.Add("bindingResource", bindingResource); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + _url = _url.Replace("{bindingName}", System.Uri.EscapeDataString(bindingName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -977,7 +1108,7 @@ internal BindingsOperations(AppPlatformManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1008,6 +1139,12 @@ internal BindingsOperations(AppPlatformManagementClient client) // Serialize Request string _requestContent = null; + if(bindingResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindingResource, 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) { @@ -1028,7 +1165,7 @@ internal BindingsOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1063,7 +1200,7 @@ internal BindingsOperations(AppPlatformManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1076,7 +1213,25 @@ internal BindingsOperations(AppPlatformManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperationsExtensions.cs index b142c94ba3d1..2804b4ee0485 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperationsExtensions.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/BindingsOperationsExtensions.cs @@ -97,7 +97,7 @@ public static BindingResource Get(this IBindingsOperations operations, string re /// /// Parameters for the create or update operation /// - public static BindingResource CreateOrUpdate(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource)) + public static BindingResource CreateOrUpdate(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource) { return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource).GetAwaiter().GetResult(); } @@ -127,7 +127,7 @@ public static BindingResource Get(this IBindingsOperations operations, string re /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource, null, cancellationToken).ConfigureAwait(false)) { @@ -208,7 +208,7 @@ public static void Delete(this IBindingsOperations operations, string resourceGr /// /// Parameters for the update operation /// - public static BindingResource Update(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource)) + public static BindingResource Update(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource) { return operations.UpdateAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource).GetAwaiter().GetResult(); } @@ -238,7 +238,7 @@ public static void Delete(this IBindingsOperations operations, string resourceGr /// /// The cancellation token. /// - public static async Task UpdateAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource, null, cancellationToken).ConfigureAwait(false)) { @@ -294,6 +294,177 @@ public static IPage List(this IBindingsOperations operations, s } } + /// + /// Create a new Binding or update an exiting Binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the create or update operation + /// + public static BindingResource BeginCreateOrUpdate(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource).GetAwaiter().GetResult(); + } + + /// + /// Create a new Binding or update an exiting Binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Operation to delete a Binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + public static void BeginDelete(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName) + { + operations.BeginDeleteAsync(resourceGroupName, serviceName, appName, bindingName).GetAwaiter().GetResult(); + } + + /// + /// Operation to delete a Binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Operation to update an exiting Binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the update operation + /// + public static BindingResource BeginUpdate(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource) + { + return operations.BeginUpdateAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource).GetAwaiter().GetResult(); + } + + /// + /// Operation to update an exiting Binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IBindingsOperations operations, string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, bindingName, bindingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Handles requests to list all resources in an App. /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs new file mode 100644 index 000000000000..392174d44df4 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs @@ -0,0 +1,1114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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(AppPlatformManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AppPlatformManagementClient + /// + public AppPlatformManagementClient Client { get; private set; } + + /// + /// Get the certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + 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/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, certificateResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete the certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all the certificates of one user. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateResource"); + } + if (certificateResource != null) + { + certificateResource.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("serviceName", serviceName); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("certificateResource", certificateResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _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(certificateResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(certificateResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// 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 serviceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + 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/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the certificates of one user. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperationsExtensions.cs new file mode 100644 index 000000000000..25acbdc714ca --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperationsExtensions.cs @@ -0,0 +1,347 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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 the certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + public static CertificateResource Get(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName) + { + return operations.GetAsync(resourceGroupName, serviceName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Get the certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + public static CertificateResource CreateOrUpdate(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, certificateName, certificateResource).GetAwaiter().GetResult(); + } + + /// + /// Create or update certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, certificateResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + public static void Delete(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName) + { + operations.DeleteAsync(resourceGroupName, serviceName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Delete the certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all the certificates of one user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + public static IPage List(this ICertificatesOperations operations, string resourceGroupName, string serviceName) + { + return operations.ListAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// List all the certificates of one user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICertificatesOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + public static CertificateResource BeginCreateOrUpdate(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, certificateName, certificateResource).GetAwaiter().GetResult(); + } + + /// + /// Create or update certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, certificateResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + public static void BeginDelete(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName) + { + operations.BeginDeleteAsync(resourceGroupName, serviceName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Delete the certificate resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICertificatesOperations operations, string resourceGroupName, string serviceName, string certificateName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, certificateName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all the certificates of one user. + /// + /// + /// 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 the certificates of one user. + /// + /// + /// 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/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperations.cs new file mode 100644 index 000000000000..23371dfa0656 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperations.cs @@ -0,0 +1,753 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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; + + /// + /// ConfigServersOperations operations. + /// + internal partial class ConfigServersOperations : IServiceOperations, IConfigServersOperations + { + /// + /// Initializes a new instance of the ConfigServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ConfigServersOperations(AppPlatformManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AppPlatformManagementClient + /// + public AppPlatformManagementClient Client { get; private set; } + + /// + /// Get the config server and its properties. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdatePutWithHttpMessagesAsync(resourceGroupName, serviceName, configServerResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdatePatchWithHttpMessagesAsync(resourceGroupName, serviceName, configServerResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (configServerResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configServerResource"); + } + if (configServerResource != null) + { + configServerResource.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("serviceName", serviceName); + tracingParameters.Add("configServerResource", configServerResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdatePut", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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(configServerResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(configServerResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (configServerResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configServerResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("configServerResource", configServerResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdatePatch", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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(configServerResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(configServerResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperationsExtensions.cs new file mode 100644 index 000000000000..4c39e83152f2 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ConfigServersOperationsExtensions.cs @@ -0,0 +1,259 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ConfigServersOperations. + /// + public static partial class ConfigServersOperationsExtensions + { + /// + /// Get the config server and its properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + public static ConfigServerResource Get(this IConfigServersOperations operations, string resourceGroupName, string serviceName) + { + return operations.GetAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Get the config server and its properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IConfigServersOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static ConfigServerResource UpdatePut(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource) + { + return operations.UpdatePutAsync(resourceGroupName, serviceName, configServerResource).GetAwaiter().GetResult(); + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePutAsync(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePutWithHttpMessagesAsync(resourceGroupName, serviceName, configServerResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static ConfigServerResource UpdatePatch(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource) + { + return operations.UpdatePatchAsync(resourceGroupName, serviceName, configServerResource).GetAwaiter().GetResult(); + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePatchAsync(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePatchWithHttpMessagesAsync(resourceGroupName, serviceName, configServerResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static ConfigServerResource BeginUpdatePut(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource) + { + return operations.BeginUpdatePutAsync(resourceGroupName, serviceName, configServerResource).GetAwaiter().GetResult(); + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdatePutAsync(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdatePutWithHttpMessagesAsync(resourceGroupName, serviceName, configServerResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static ConfigServerResource BeginUpdatePatch(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource) + { + return operations.BeginUpdatePatchAsync(resourceGroupName, serviceName, configServerResource).GetAwaiter().GetResult(); + } + + /// + /// Update the config server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdatePatchAsync(this IConfigServersOperations operations, string resourceGroupName, string serviceName, ConfigServerResource configServerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdatePatchWithHttpMessagesAsync(resourceGroupName, serviceName, configServerResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperations.cs new file mode 100644 index 000000000000..fa3b3985664f --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperations.cs @@ -0,0 +1,1427 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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; + + /// + /// CustomDomainsOperations operations. + /// + internal partial class CustomDomainsOperations : IServiceOperations, ICustomDomainsOperations + { + /// + /// Initializes a new instance of the CustomDomainsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomDomainsOperations(AppPlatformManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AppPlatformManagementClient + /// + public AppPlatformManagementClient Client { get; private set; } + + /// + /// Get the custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + if (domainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + tracingParameters.Add("domainName", domainName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + _url = _url.Replace("{domainName}", System.Uri.EscapeDataString(domainName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, domainResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, domainResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + if (domainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainName"); + } + if (domainResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + tracingParameters.Add("domainName", domainName); + tracingParameters.Add("domainResource", domainResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + _url = _url.Replace("{domainName}", System.Uri.EscapeDataString(domainName)); + 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(domainResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(domainResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// 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 serviceName, string appName, string domainName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + if (domainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + tracingParameters.Add("domainName", domainName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + _url = _url.Replace("{domainName}", System.Uri.EscapeDataString(domainName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + if (domainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainName"); + } + if (domainResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "domainResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + tracingParameters.Add("domainName", domainName); + tracingParameters.Add("domainResource", domainResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + _url = _url.Replace("{domainName}", System.Uri.EscapeDataString(domainName)); + 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(domainResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(domainResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperationsExtensions.cs new file mode 100644 index 000000000000..946e64ac10e7 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CustomDomainsOperationsExtensions.cs @@ -0,0 +1,503 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CustomDomainsOperations. + /// + public static partial class CustomDomainsOperationsExtensions + { + /// + /// Get the custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + public static CustomDomainResource Get(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName) + { + return operations.GetAsync(resourceGroupName, serviceName, appName, domainName).GetAwaiter().GetResult(); + } + + /// + /// Get the custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + public static CustomDomainResource CreateOrUpdate(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, appName, domainName, domainResource).GetAwaiter().GetResult(); + } + + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, domainResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + public static void Delete(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName) + { + operations.DeleteAsync(resourceGroupName, serviceName, appName, domainName).GetAwaiter().GetResult(); + } + + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + public static CustomDomainResource Update(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource) + { + return operations.UpdateAsync(resourceGroupName, serviceName, appName, domainName, domainResource).GetAwaiter().GetResult(); + } + + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, domainResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + public static IPage List(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName) + { + return operations.ListAsync(resourceGroupName, serviceName, appName).GetAwaiter().GetResult(); + } + + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, serviceName, appName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + public static CustomDomainResource BeginCreateOrUpdate(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, domainName, domainResource).GetAwaiter().GetResult(); + } + + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, domainResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + public static void BeginDelete(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName) + { + operations.BeginDeleteAsync(resourceGroupName, serviceName, appName, domainName).GetAwaiter().GetResult(); + } + + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + public static CustomDomainResource BeginUpdate(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource) + { + return operations.BeginUpdateAsync(resourceGroupName, serviceName, appName, domainName, domainResource).GetAwaiter().GetResult(); + } + + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ICustomDomainsOperations operations, string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, domainName, domainResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICustomDomainsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// 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 ICustomDomainsOperations 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/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperations.cs index ddea91a1e7e7..6947bec807b0 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperations.cs @@ -286,7 +286,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource, customHeaders, cancellationToken).ConfigureAwait(false); @@ -310,177 +310,16 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// The name of the Deployment resource. /// /// - /// Headers that will be added to request. + /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serviceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); - } - if (appName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appName"); - } - if (deploymentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("appName", appName); - tracingParameters.Add("deploymentName", deploymentName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); - _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); - _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 != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -508,7 +347,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource, customHeaders, cancellationToken).ConfigureAwait(false); @@ -577,10 +416,10 @@ internal DeploymentsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("version", version); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); + tracingParameters.Add("version", version); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -592,6 +431,10 @@ internal DeploymentsOperations(AppPlatformManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } if (version != null) { if (version.Count == 0) @@ -606,10 +449,6 @@ internal DeploymentsOperations(AppPlatformManagementClient client) } } } - 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); @@ -769,7 +608,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListClusterAllDeploymentsWithHttpMessagesAsync(string resourceGroupName, string serviceName, IList version = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListForClusterWithHttpMessagesAsync(string resourceGroupName, string serviceName, IList version = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -790,11 +629,11 @@ internal DeploymentsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("version", version); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("version", version); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListClusterAllDeployments", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForCluster", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -803,6 +642,10 @@ internal DeploymentsOperations(AppPlatformManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } if (version != null) { if (version.Count == 0) @@ -817,10 +660,6 @@ internal DeploymentsOperations(AppPlatformManagementClient client) } } } - 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); @@ -1284,12 +1123,8 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (deploymentResource != null) - { - deploymentResource.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1310,6 +1145,10 @@ internal DeploymentsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); } + if (deploymentResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentResource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1317,11 +1156,11 @@ internal DeploymentsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("deploymentResource", deploymentResource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("deploymentResource", deploymentResource); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1402,7 +1241,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1480,6 +1319,214 @@ internal DeploymentsOperations(AppPlatformManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Operation to delete a Deployment. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Deployment resource. + /// + /// + /// 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 serviceName, string appName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (appName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "appName"); + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("appName", appName); + 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/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{appName}", System.Uri.EscapeDataString(appName)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1527,7 +1574,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1549,6 +1596,10 @@ internal DeploymentsOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); } + if (deploymentResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentResource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1556,11 +1607,11 @@ internal DeploymentsOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("deploymentResource", deploymentResource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("appName", appName); tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("deploymentResource", deploymentResource); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -2496,7 +2547,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListClusterAllDeploymentsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListForClusterNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2511,7 +2562,7 @@ internal DeploymentsOperations(AppPlatformManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListClusterAllDeploymentsNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForClusterNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperationsExtensions.cs index ccc13f39adb3..cf1c0897f766 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperationsExtensions.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperationsExtensions.cs @@ -99,7 +99,7 @@ public static DeploymentResource Get(this IDeploymentsOperations operations, str /// /// Parameters for the create or update operation /// - public static DeploymentResource CreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource)) + public static DeploymentResource CreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource) { return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource).GetAwaiter().GetResult(); } @@ -129,7 +129,7 @@ public static DeploymentResource Get(this IDeploymentsOperations operations, str /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource, null, cancellationToken).ConfigureAwait(false)) { @@ -210,7 +210,7 @@ public static void Delete(this IDeploymentsOperations operations, string resourc /// /// Parameters for the update operation /// - public static DeploymentResource Update(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource)) + public static DeploymentResource Update(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource) { return operations.UpdateAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource).GetAwaiter().GetResult(); } @@ -240,7 +240,7 @@ public static void Delete(this IDeploymentsOperations operations, string resourc /// /// The cancellation token. /// - public static async Task UpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource, null, cancellationToken).ConfigureAwait(false)) { @@ -318,9 +318,9 @@ public static void Delete(this IDeploymentsOperations operations, string resourc /// /// Version of the deployments to be listed /// - public static IPage ListClusterAllDeployments(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, IList version = default(IList)) + public static IPage ListForCluster(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, IList version = default(IList)) { - return operations.ListClusterAllDeploymentsAsync(resourceGroupName, serviceName, version).GetAwaiter().GetResult(); + return operations.ListForClusterAsync(resourceGroupName, serviceName, version).GetAwaiter().GetResult(); } /// @@ -342,9 +342,9 @@ public static void Delete(this IDeploymentsOperations operations, string resourc /// /// The cancellation token. /// - public static async Task> ListClusterAllDeploymentsAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, IList version = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListForClusterAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, IList version = default(IList), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListClusterAllDeploymentsWithHttpMessagesAsync(resourceGroupName, serviceName, version, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForClusterWithHttpMessagesAsync(resourceGroupName, serviceName, version, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -579,7 +579,7 @@ public static LogFileUrlResponse GetLogFileUrl(this IDeploymentsOperations opera /// /// Parameters for the create or update operation /// - public static DeploymentResource BeginCreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource)) + public static DeploymentResource BeginCreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource).GetAwaiter().GetResult(); } @@ -609,7 +609,7 @@ public static LogFileUrlResponse GetLogFileUrl(this IDeploymentsOperations opera /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource, null, cancellationToken).ConfigureAwait(false)) { @@ -617,6 +617,57 @@ public static LogFileUrlResponse GetLogFileUrl(this IDeploymentsOperations opera } } + /// + /// Operation to delete a Deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Deployment resource. + /// + public static void BeginDelete(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName) + { + operations.BeginDeleteAsync(resourceGroupName, serviceName, appName, deploymentName).GetAwaiter().GetResult(); + } + + /// + /// Operation to delete a Deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Deployment resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Operation to update an exiting Deployment. /// @@ -639,7 +690,7 @@ public static LogFileUrlResponse GetLogFileUrl(this IDeploymentsOperations opera /// /// Parameters for the update operation /// - public static DeploymentResource BeginUpdate(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource)) + public static DeploymentResource BeginUpdate(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource) { return operations.BeginUpdateAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource).GetAwaiter().GetResult(); } @@ -669,7 +720,7 @@ public static LogFileUrlResponse GetLogFileUrl(this IDeploymentsOperations opera /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, deploymentResource, null, cancellationToken).ConfigureAwait(false)) { @@ -873,9 +924,9 @@ public static IPage ListNext(this IDeploymentsOperations ope /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListClusterAllDeploymentsNext(this IDeploymentsOperations operations, string nextPageLink) + public static IPage ListForClusterNext(this IDeploymentsOperations operations, string nextPageLink) { - return operations.ListClusterAllDeploymentsNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListForClusterNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -890,9 +941,9 @@ public static IPage ListClusterAllDeploymentsNext(this IDepl /// /// The cancellation token. /// - public static async Task> ListClusterAllDeploymentsNextAsync(this IDeploymentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListForClusterNextAsync(this IDeploymentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListClusterAllDeploymentsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForClusterNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppPlatformManagementClient.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppPlatformManagementClient.cs index 2f2ac51bed1c..9c4f13321317 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppPlatformManagementClient.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppPlatformManagementClient.cs @@ -76,6 +76,16 @@ public partial interface IAppPlatformManagementClient : System.IDisposable /// IServicesOperations Services { get; } + /// + /// Gets the IConfigServersOperations. + /// + IConfigServersOperations ConfigServers { get; } + + /// + /// Gets the IMonitoringSettingsOperations. + /// + IMonitoringSettingsOperations MonitoringSettings { get; } + /// /// Gets the IAppsOperations. /// @@ -86,6 +96,16 @@ public partial interface IAppPlatformManagementClient : System.IDisposable /// IBindingsOperations Bindings { get; } + /// + /// Gets the ICertificatesOperations. + /// + ICertificatesOperations Certificates { get; } + + /// + /// Gets the ICustomDomainsOperations. + /// + ICustomDomainsOperations CustomDomains { get; } + /// /// Gets the IDeploymentsOperations. /// @@ -96,5 +116,10 @@ public partial interface IAppPlatformManagementClient : System.IDisposable /// IOperations Operations { get; } + /// + /// Gets the ISkusOperations. + /// + ISkusOperations Skus { get; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppsOperations.cs index 94d306ba27ba..a62e49523f0f 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppsOperations.cs @@ -88,7 +88,7 @@ public partial interface IAppsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to delete an App. /// @@ -148,7 +148,7 @@ public partial interface IAppsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Handles requests to list all resources in a Service. /// @@ -208,6 +208,39 @@ public partial interface IAppsOperations /// Task> GetResourceUploadUrlWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Check the resource name is valid as well as not in use. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// Custom domain payload to be validated + /// + /// + /// 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> ValidateDomainWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, CustomDomainValidatePayload validatePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create a new App or update an exiting App. /// /// @@ -239,7 +272,34 @@ public partial interface IAppsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Operation to delete an App. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// 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 serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to update an exiting App. /// @@ -272,7 +332,7 @@ public partial interface IAppsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource = default(AppResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, AppResource appResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Handles requests to list all resources in a Service. /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IBindingsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IBindingsOperations.cs index 004a05161abc..a173eee3bb4c 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IBindingsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IBindingsOperations.cs @@ -91,7 +91,7 @@ public partial interface IBindingsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to delete a Binding. /// @@ -157,7 +157,7 @@ public partial interface IBindingsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource = default(BindingResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Handles requests to list all resources in an App. /// @@ -189,6 +189,108 @@ public partial interface IBindingsOperations /// Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Create a new Binding or update an exiting Binding. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Operation to delete a Binding. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// 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 serviceName, string appName, string bindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Operation to update an exiting Binding. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Binding resource. + /// + /// + /// Parameters for the update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string bindingName, BindingResource bindingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Handles requests to list all resources in an App. /// /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICertificatesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICertificatesOperations.cs new file mode 100644 index 000000000000..236b0f8a5ad3 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICertificatesOperations.cs @@ -0,0 +1,226 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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 the certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// 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 serviceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the certificates of one user. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateName, CertificateResource certificateResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the certificate resource. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the certificate resource. + /// + /// + /// 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 serviceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the certificates of one user. + /// + /// + /// 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/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IConfigServersOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IConfigServersOperations.cs new file mode 100644 index 000000000000..c8847958b2bf --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IConfigServersOperations.cs @@ -0,0 +1,174 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ConfigServersOperations operations. + /// + public partial interface IConfigServersOperations + { + /// + /// Get the config server and its properties. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> UpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> UpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the config server. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, ConfigServerResource configServerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICustomDomainsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICustomDomainsOperations.cs new file mode 100644 index 000000000000..8a3987c1b6cc --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ICustomDomainsOperations.cs @@ -0,0 +1,316 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CustomDomainsOperations operations. + /// + public partial interface ICustomDomainsOperations + { + /// + /// Get the custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// 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 serviceName, string appName, string domainName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// 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 serviceName, string appName, string domainName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update custom domain of one lifecycle application. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the custom domain resource. + /// + /// + /// Parameters for the create or update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string domainName, CustomDomainResource domainResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the custom domains of one lifecycle application. + /// + /// + /// 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/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IDeploymentsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IDeploymentsOperations.cs index cff4e12aa866..3fccb3e518fb 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IDeploymentsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IDeploymentsOperations.cs @@ -91,7 +91,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to delete a Deployment. /// @@ -157,7 +157,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Handles requests to list all resources in an App. /// @@ -220,7 +220,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListClusterAllDeploymentsWithHttpMessagesAsync(string resourceGroupName, string serviceName, IList version = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListForClusterWithHttpMessagesAsync(string resourceGroupName, string serviceName, IList version = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Start the deployment. /// @@ -379,7 +379,37 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Operation to delete a Deployment. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The name of the App resource. + /// + /// + /// The name of the Deployment resource. + /// + /// + /// 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 serviceName, string appName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to update an exiting Deployment. /// @@ -415,7 +445,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource = default(DeploymentResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DeploymentResource deploymentResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Start the deployment. /// @@ -549,6 +579,6 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListClusterAllDeploymentsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListForClusterNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IMonitoringSettingsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IMonitoringSettingsOperations.cs new file mode 100644 index 000000000000..f53e93270a6a --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IMonitoringSettingsOperations.cs @@ -0,0 +1,174 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MonitoringSettingsOperations operations. + /// + public partial interface IMonitoringSettingsOperations + { + /// + /// Get the Monitoring Setting and its properties. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> UpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> UpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs index 7a423182f725..f47680e5ee37 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs @@ -79,7 +79,7 @@ public partial interface IServicesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to delete a Service. /// @@ -133,7 +133,7 @@ public partial interface IServicesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List test keys for a Service. /// @@ -190,7 +190,10 @@ public partial interface IServicesOperations /// /// Thrown when a required parameter is null /// - Task> RegenerateTestKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest = default(RegenerateTestKeyRequestPayload), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> RegenerateTestKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Disable test endpoint functionality for a Service. + /// /// /// The name of the resource group that contains the resource. You can /// obtain this value from the Azure Resource Manager API or the @@ -212,6 +215,9 @@ public partial interface IServicesOperations /// Thrown when a required parameter is null /// Task DisableTestEndpointWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Enable test endpoint functionality for a Service. + /// /// /// The name of the resource group that contains the resource. You can /// obtain this value from the Azure Resource Manager API or the @@ -333,7 +339,7 @@ public partial interface IServicesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Operation to delete a Service. /// @@ -387,7 +393,7 @@ public partial interface IServicesOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Handles requests to list all resources in a subscription. /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ISkusOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ISkusOperations.cs new file mode 100644 index 000000000000..02e8ed13d4b4 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ISkusOperations.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.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SkusOperations operations. + /// + public partial interface ISkusOperations + { + /// + /// Lists all of the available skus of the Microsoft.AppPlatform + /// provider. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available skus of the Microsoft.AppPlatform + /// provider. + /// + /// + /// 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/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResource.cs index 7de0ba73bd8c..beed1a0ed46e 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResource.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResource.cs @@ -34,10 +34,16 @@ public AppResource() /// The name of the resource. /// The type of the resource. /// Properties of the App resource - public AppResource(string id = default(string), string name = default(string), string type = default(string), AppResourceProperties properties = default(AppResourceProperties)) + /// The Managed Identity type of the app + /// resource + /// The GEO location of the application, always + /// the same with its parent resource + public AppResource(string id = default(string), string name = default(string), string type = default(string), AppResourceProperties properties = default(AppResourceProperties), ManagedIdentityProperties identity = default(ManagedIdentityProperties), string location = default(string)) : base(id, name, type) { Properties = properties; + Identity = identity; + Location = location; CustomInit(); } @@ -52,6 +58,19 @@ public AppResource() [JsonProperty(PropertyName = "properties")] public AppResourceProperties Properties { get; set; } + /// + /// Gets or sets the Managed Identity type of the app resource + /// + [JsonProperty(PropertyName = "identity")] + public ManagedIdentityProperties Identity { get; set; } + + /// + /// Gets or sets the GEO location of the application, always the same + /// with its parent resource + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + /// /// Validate the object. /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResourceProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResourceProperties.cs index 8d0164d84661..269c2197b706 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResourceProperties.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResourceProperties.cs @@ -37,16 +37,20 @@ public AppResourceProperties() /// 'Updating' /// Name of the active deployment of /// the App + /// Fully qualified dns Name. + /// Indicate if only https is allowed. /// Date time when the resource is /// created /// Temporary disk settings /// Persistent disk settings - public AppResourceProperties(bool? publicProperty = default(bool?), string url = default(string), string provisioningState = default(string), string activeDeploymentName = default(string), System.DateTime? createdTime = default(System.DateTime?), TemporaryDisk temporaryDisk = default(TemporaryDisk), PersistentDisk persistentDisk = default(PersistentDisk)) + public AppResourceProperties(bool? publicProperty = default(bool?), string url = default(string), string provisioningState = default(string), string activeDeploymentName = default(string), string fqdn = default(string), bool? httpsOnly = default(bool?), System.DateTime? createdTime = default(System.DateTime?), TemporaryDisk temporaryDisk = default(TemporaryDisk), PersistentDisk persistentDisk = default(PersistentDisk)) { PublicProperty = publicProperty; Url = url; ProvisioningState = provisioningState; ActiveDeploymentName = activeDeploymentName; + Fqdn = fqdn; + HttpsOnly = httpsOnly; CreatedTime = createdTime; TemporaryDisk = temporaryDisk; PersistentDisk = persistentDisk; @@ -83,6 +87,18 @@ public AppResourceProperties() [JsonProperty(PropertyName = "activeDeploymentName")] public string ActiveDeploymentName { get; set; } + /// + /// Gets or sets fully qualified dns Name. + /// + [JsonProperty(PropertyName = "fqdn")] + public string Fqdn { get; set; } + + /// + /// Gets or sets indicate if only https is allowed. + /// + [JsonProperty(PropertyName = "httpsOnly")] + public bool? HttpsOnly { get; set; } + /// /// Gets date time when the resource is created /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/BindingResourceProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/BindingResourceProperties.cs index d2d7e66e2e73..c4a09468f678 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/BindingResourceProperties.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/BindingResourceProperties.cs @@ -64,16 +64,16 @@ public BindingResourceProperties() partial void CustomInit(); /// - /// Gets or sets the name of the bound resource + /// Gets the name of the bound resource /// [JsonProperty(PropertyName = "resourceName")] - public string ResourceName { get; set; } + public string ResourceName { get; private set; } /// - /// Gets or sets the standard Azure resource type of the bound resource + /// Gets the standard Azure resource type of the bound resource /// [JsonProperty(PropertyName = "resourceType")] - public string ResourceType { get; set; } + public string ResourceType { get; private set; } /// /// Gets or sets the Azure resource id of the bound resource diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateProperties.cs new file mode 100644 index 000000000000..1c329b618576 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateProperties.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Certificate resource payload. + /// + public partial class CertificateProperties + { + /// + /// Initializes a new instance of the CertificateProperties class. + /// + public CertificateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateProperties class. + /// + /// The vault uri of user key vault. + /// The certificate name of key + /// vault. + /// The thumbprint of certificate. + /// The certificate version of key + /// vault. + /// The issuer of certificate. + /// The issue date of certificate. + /// The expiration date of + /// certificate. + /// The activate date of + /// certificate. + /// The subject name of certificate. + /// The domain list of certificate. + public CertificateProperties(string vaultUri, string keyVaultCertName, string thumbprint = default(string), string certVersion = default(string), string issuer = default(string), string issuedDate = default(string), string expirationDate = default(string), string activateDate = default(string), string subjectName = default(string), IList dnsNames = default(IList)) + { + Thumbprint = thumbprint; + VaultUri = vaultUri; + KeyVaultCertName = keyVaultCertName; + CertVersion = certVersion; + Issuer = issuer; + IssuedDate = issuedDate; + ExpirationDate = expirationDate; + ActivateDate = activateDate; + SubjectName = subjectName; + DnsNames = dnsNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the thumbprint of certificate. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; private set; } + + /// + /// Gets or sets the vault uri of user key vault. + /// + [JsonProperty(PropertyName = "vaultUri")] + public string VaultUri { get; set; } + + /// + /// Gets or sets the certificate name of key vault. + /// + [JsonProperty(PropertyName = "keyVaultCertName")] + public string KeyVaultCertName { get; set; } + + /// + /// Gets or sets the certificate version of key vault. + /// + [JsonProperty(PropertyName = "certVersion")] + public string CertVersion { get; set; } + + /// + /// Gets the issuer of certificate. + /// + [JsonProperty(PropertyName = "issuer")] + public string Issuer { get; private set; } + + /// + /// Gets the issue date of certificate. + /// + [JsonProperty(PropertyName = "issuedDate")] + public string IssuedDate { get; private set; } + + /// + /// Gets the expiration date of certificate. + /// + [JsonProperty(PropertyName = "expirationDate")] + public string ExpirationDate { get; private set; } + + /// + /// Gets the activate date of certificate. + /// + [JsonProperty(PropertyName = "activateDate")] + public string ActivateDate { get; private set; } + + /// + /// Gets the subject name of certificate. + /// + [JsonProperty(PropertyName = "subjectName")] + public string SubjectName { get; private set; } + + /// + /// Gets the domain list of certificate. + /// + [JsonProperty(PropertyName = "dnsNames")] + public IList DnsNames { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VaultUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VaultUri"); + } + if (KeyVaultCertName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyVaultCertName"); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateResource.cs new file mode 100644 index 000000000000..7b5989b76c86 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateResource.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.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Certificate resource payload. + /// + public partial class CertificateResource : ProxyResource + { + /// + /// Initializes a new instance of the CertificateResource class. + /// + public CertificateResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateResource class. + /// + /// Fully qualified resource Id for the + /// resource. + /// The name of the resource. + /// The type of the resource. + /// Properties of the certificate resource + /// payload. + public CertificateResource(string id = default(string), string name = default(string), string type = default(string), CertificateProperties properties = default(CertificateProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the certificate resource payload. + /// + [JsonProperty(PropertyName = "properties")] + public CertificateProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ClusterResourceProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ClusterResourceProperties.cs index 4a2fa2c030e7..e0b7a369e892 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ClusterResourceProperties.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ClusterResourceProperties.cs @@ -33,17 +33,14 @@ public ClusterResourceProperties() /// Possible values include: 'Creating', 'Updating', 'Deleting', /// 'Deleted', 'Succeeded', 'Failed', 'Moving', 'Moved', /// 'MoveFailed' - /// Config server git properties - /// of the Service - /// Trace properties of the Service + /// Network profile of the Service /// Version of the Service /// ServiceInstanceEntity GUID which uniquely /// identifies a created resource - public ClusterResourceProperties(string provisioningState = default(string), ConfigServerProperties configServerProperties = default(ConfigServerProperties), TraceProperties trace = default(TraceProperties), int? version = default(int?), string serviceId = default(string)) + public ClusterResourceProperties(string provisioningState = default(string), NetworkProfile networkProfile = default(NetworkProfile), int? version = default(int?), string serviceId = default(string)) { ProvisioningState = provisioningState; - ConfigServerProperties = configServerProperties; - Trace = trace; + NetworkProfile = networkProfile; Version = version; ServiceId = serviceId; CustomInit(); @@ -63,16 +60,10 @@ public ClusterResourceProperties() public string ProvisioningState { get; private set; } /// - /// Gets or sets config server git properties of the Service + /// Gets or sets network profile of the Service /// - [JsonProperty(PropertyName = "configServerProperties")] - public ConfigServerProperties ConfigServerProperties { get; set; } - - /// - /// Gets or sets trace properties of the Service - /// - [JsonProperty(PropertyName = "trace")] - public TraceProperties Trace { get; set; } + [JsonProperty(PropertyName = "networkProfile")] + public NetworkProfile NetworkProfile { get; set; } /// /// Gets version of the Service @@ -87,18 +78,5 @@ public ClusterResourceProperties() [JsonProperty(PropertyName = "serviceId")] public string ServiceId { get; private set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ConfigServerProperties != null) - { - ConfigServerProperties.Validate(); - } - } } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerProperties.cs index ac9d9d87fce0..8bd98047ff80 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerProperties.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerProperties.cs @@ -29,15 +29,15 @@ public ConfigServerProperties() /// /// Initializes a new instance of the ConfigServerProperties class. /// - /// State of the config server. Possible values - /// include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', - /// 'Updating' + /// State of the config server. + /// Possible values include: 'NotAvailable', 'Deleted', 'Failed', + /// 'Succeeded', 'Updating' /// Error when apply config server /// settings. /// Settings of config server. - public ConfigServerProperties(string state = default(string), Error error = default(Error), ConfigServerSettings configServer = default(ConfigServerSettings)) + public ConfigServerProperties(string provisioningState = default(string), Error error = default(Error), ConfigServerSettings configServer = default(ConfigServerSettings)) { - State = state; + ProvisioningState = provisioningState; Error = error; ConfigServer = configServer; CustomInit(); @@ -52,8 +52,8 @@ public ConfigServerProperties() /// Gets state of the config server. Possible values include: /// 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' /// - [JsonProperty(PropertyName = "state")] - public string State { get; private set; } + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } /// /// Gets or sets error when apply config server settings. diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerResource.cs new file mode 100644 index 000000000000..2017819d1012 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ConfigServerResource.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.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Config Server resource + /// + public partial class ConfigServerResource : ProxyResource + { + /// + /// Initializes a new instance of the ConfigServerResource class. + /// + public ConfigServerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfigServerResource class. + /// + /// Fully qualified resource Id for the + /// resource. + /// The name of the resource. + /// The type of the resource. + /// Properties of the Config Server + /// resource + public ConfigServerResource(string id = default(string), string name = default(string), string type = default(string), ConfigServerProperties properties = default(ConfigServerProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the Config Server resource + /// + [JsonProperty(PropertyName = "properties")] + public ConfigServerProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainProperties.cs new file mode 100644 index 000000000000..dd88e6cbf710 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainProperties.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.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Custom domain of app resource payload. + /// + public partial class CustomDomainProperties + { + /// + /// Initializes a new instance of the CustomDomainProperties class. + /// + public CustomDomainProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomDomainProperties class. + /// + /// The thumbprint of bound + /// certificate. + /// The app name of domain. + /// The bound certificate name of + /// domain. + public CustomDomainProperties(string thumbprint = default(string), string appName = default(string), string certName = default(string)) + { + Thumbprint = thumbprint; + AppName = appName; + CertName = certName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the thumbprint of bound certificate. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; set; } + + /// + /// Gets the app name of domain. + /// + [JsonProperty(PropertyName = "appName")] + public string AppName { get; private set; } + + /// + /// Gets or sets the bound certificate name of domain. + /// + [JsonProperty(PropertyName = "certName")] + public string CertName { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainResource.cs new file mode 100644 index 000000000000..4934ad8c2444 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainResource.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.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Custom domain resource payload. + /// + public partial class CustomDomainResource : ProxyResource + { + /// + /// Initializes a new instance of the CustomDomainResource class. + /// + public CustomDomainResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomDomainResource class. + /// + /// Fully qualified resource Id for the + /// resource. + /// The name of the resource. + /// The type of the resource. + /// Properties of the custom domain + /// resource. + public CustomDomainResource(string id = default(string), string name = default(string), string type = default(string), CustomDomainProperties properties = default(CustomDomainProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the custom domain resource. + /// + [JsonProperty(PropertyName = "properties")] + public CustomDomainProperties Properties { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidatePayload.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidatePayload.cs new file mode 100644 index 000000000000..704c1962c25a --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidatePayload.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Custom domain validate payload. + /// + public partial class CustomDomainValidatePayload + { + /// + /// Initializes a new instance of the CustomDomainValidatePayload + /// class. + /// + public CustomDomainValidatePayload() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomDomainValidatePayload + /// class. + /// + /// Name to be validated + public CustomDomainValidatePayload(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name to be validated + /// + [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/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidateResult.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidateResult.cs new file mode 100644 index 000000000000..ac7b8ecd0acf --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomDomainValidateResult.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Validation result for custom domain. + /// + public partial class CustomDomainValidateResult + { + /// + /// Initializes a new instance of the CustomDomainValidateResult class. + /// + public CustomDomainValidateResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomDomainValidateResult class. + /// + /// Indicates if domain name is valid. + /// Message of why domain name is + /// invalid. + public CustomDomainValidateResult(bool? isValid = default(bool?), string message = default(string)) + { + IsValid = isValid; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates if domain name is valid. + /// + [JsonProperty(PropertyName = "isValid")] + public bool? IsValid { get; set; } + + /// + /// Gets or sets message of why domain name is invalid. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResource.cs index 59a2dde3573c..449241506baa 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResource.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResource.cs @@ -35,10 +35,12 @@ public DeploymentResource() /// The type of the resource. /// Properties of the Deployment /// resource - public DeploymentResource(string id = default(string), string name = default(string), string type = default(string), DeploymentResourceProperties properties = default(DeploymentResourceProperties)) + /// Sku of the Deployment resource + public DeploymentResource(string id = default(string), string name = default(string), string type = default(string), DeploymentResourceProperties properties = default(DeploymentResourceProperties), Sku sku = default(Sku)) : base(id, name, type) { Properties = properties; + Sku = sku; CustomInit(); } @@ -54,17 +56,10 @@ public DeploymentResource() public DeploymentResourceProperties Properties { get; set; } /// - /// Validate the object. + /// Gets or sets sku of the Deployment resource /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties != null) - { - Properties.Validate(); - } - } + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResourceProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResourceProperties.cs index 9aecafe50082..c6c698e3af93 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResourceProperties.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentResourceProperties.cs @@ -36,11 +36,11 @@ public DeploymentResourceProperties() /// Uploaded source information of the /// deployment. /// App name of the deployment + /// Deployment settings of the + /// Deployment /// Provisioning state of the /// Deployment. Possible values include: 'Creating', 'Updating', /// 'Succeeded', 'Failed' - /// Deployment settings of the - /// Deployment /// Status of the Deployment. Possible values /// include: 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', /// 'Upgrading', 'Compiling' @@ -50,12 +50,12 @@ public DeploymentResourceProperties() /// created /// Collection of instances belong to the /// Deployment - public DeploymentResourceProperties(UserSourceInfo source = default(UserSourceInfo), string appName = default(string), string provisioningState = default(string), DeploymentSettings deploymentSettings = default(DeploymentSettings), string status = default(string), bool? active = default(bool?), System.DateTime? createdTime = default(System.DateTime?), IList instances = default(IList)) + public DeploymentResourceProperties(UserSourceInfo source = default(UserSourceInfo), string appName = default(string), DeploymentSettings deploymentSettings = default(DeploymentSettings), string provisioningState = default(string), string status = default(string), bool? active = default(bool?), System.DateTime? createdTime = default(System.DateTime?), IList instances = default(IList)) { Source = source; AppName = appName; - ProvisioningState = provisioningState; DeploymentSettings = deploymentSettings; + ProvisioningState = provisioningState; Status = status; Active = active; CreatedTime = createdTime; @@ -80,6 +80,12 @@ public DeploymentResourceProperties() [JsonProperty(PropertyName = "appName")] public string AppName { get; private set; } + /// + /// Gets or sets deployment settings of the Deployment + /// + [JsonProperty(PropertyName = "deploymentSettings")] + public DeploymentSettings DeploymentSettings { get; set; } + /// /// Gets provisioning state of the Deployment. Possible values include: /// 'Creating', 'Updating', 'Succeeded', 'Failed' @@ -87,12 +93,6 @@ public DeploymentResourceProperties() [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; private set; } - /// - /// Gets or sets deployment settings of the Deployment - /// - [JsonProperty(PropertyName = "deploymentSettings")] - public DeploymentSettings DeploymentSettings { get; set; } - /// /// Gets status of the Deployment. Possible values include: 'Unknown', /// 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', @@ -119,18 +119,5 @@ public DeploymentResourceProperties() [JsonProperty(PropertyName = "instances")] public IList Instances { get; private set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DeploymentSettings != null) - { - DeploymentSettings.Validate(); - } - } } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentSettings.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentSettings.cs index 1e42a7c11d63..22a75d79a93d 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentSettings.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DeploymentSettings.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.AppPlatform.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -32,20 +31,21 @@ public DeploymentSettings() /// /// Initializes a new instance of the DeploymentSettings class. /// - /// Required CPU - /// Required Memory size in GB + /// Required CPU, basic tier should be 1, standard + /// tier should be in range (1, 4) + /// Required Memory size in GB, basic tier + /// should be in range (1, 2), standard tier should be in range (1, + /// 8) /// JVM parameter - /// Instance count /// Collection of environment /// variables /// Runtime version. Possible values /// include: 'Java_8', 'Java_11' - public DeploymentSettings(int? cpu = default(int?), int? memoryInGB = default(int?), string jvmOptions = default(string), int? instanceCount = default(int?), IDictionary environmentVariables = default(IDictionary), string runtimeVersion = default(string)) + public DeploymentSettings(int? cpu = default(int?), int? memoryInGB = default(int?), string jvmOptions = default(string), IDictionary environmentVariables = default(IDictionary), string runtimeVersion = default(string)) { Cpu = cpu; MemoryInGB = memoryInGB; JvmOptions = jvmOptions; - InstanceCount = instanceCount; EnvironmentVariables = environmentVariables; RuntimeVersion = runtimeVersion; CustomInit(); @@ -57,13 +57,15 @@ public DeploymentSettings() partial void CustomInit(); /// - /// Gets or sets required CPU + /// Gets or sets required CPU, basic tier should be 1, standard tier + /// should be in range (1, 4) /// [JsonProperty(PropertyName = "cpu")] public int? Cpu { get; set; } /// - /// Gets or sets required Memory size in GB + /// Gets or sets required Memory size in GB, basic tier should be in + /// range (1, 2), standard tier should be in range (1, 8) /// [JsonProperty(PropertyName = "memoryInGB")] public int? MemoryInGB { get; set; } @@ -74,12 +76,6 @@ public DeploymentSettings() [JsonProperty(PropertyName = "jvmOptions")] public string JvmOptions { get; set; } - /// - /// Gets or sets instance count - /// - [JsonProperty(PropertyName = "instanceCount")] - public int? InstanceCount { get; set; } - /// /// Gets or sets collection of environment variables /// @@ -93,38 +89,5 @@ public DeploymentSettings() [JsonProperty(PropertyName = "runtimeVersion")] public string RuntimeVersion { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Cpu > 4) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Cpu", 4); - } - if (Cpu < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Cpu", 1); - } - if (MemoryInGB > 8) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MemoryInGB", 8); - } - if (MemoryInGB < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MemoryInGB", 1); - } - if (InstanceCount > 20) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "InstanceCount", 20); - } - if (InstanceCount < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "InstanceCount", 1); - } - } } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityProperties.cs new file mode 100644 index 000000000000..3fe50579265b --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityProperties.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed identity properties retrieved from ARM request headers. + /// + public partial class ManagedIdentityProperties + { + /// + /// Initializes a new instance of the ManagedIdentityProperties class. + /// + public ManagedIdentityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedIdentityProperties class. + /// + /// Type of the managed identity. Possible values + /// include: 'None', 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned' + /// Principal Id + /// Tenant Id + public ManagedIdentityProperties(string type = default(string), string principalId = default(string), string tenantId = default(string)) + { + Type = type; + PrincipalId = principalId; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the managed identity. Possible values include: + /// 'None', 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets principal Id + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets tenant Id + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityType.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityType.cs new file mode 100644 index 000000000000..33dafb8afcaa --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ManagedIdentityType.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.AppPlatform.Models +{ + + /// + /// Defines values for ManagedIdentityType. + /// + public static class ManagedIdentityType + { + public const string None = "None"; + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned,UserAssigned"; + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingProperties.cs new file mode 100644 index 000000000000..a5af2a867afb --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingProperties.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Monitoring Setting properties payload + /// + public partial class MonitoringSettingProperties + { + /// + /// Initializes a new instance of the MonitoringSettingProperties + /// class. + /// + public MonitoringSettingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MonitoringSettingProperties + /// class. + /// + /// State of the Monitoring Setting. + /// Possible values include: 'NotAvailable', 'Failed', 'Succeeded', + /// 'Updating' + /// Error when apply Monitoring Setting + /// changes. + /// Indicates whether enable the trace + /// functionality + /// Target application + /// insight instrumentation key + public MonitoringSettingProperties(string provisioningState = default(string), Error error = default(Error), bool? traceEnabled = default(bool?), string appInsightsInstrumentationKey = default(string)) + { + ProvisioningState = provisioningState; + Error = error; + TraceEnabled = traceEnabled; + AppInsightsInstrumentationKey = appInsightsInstrumentationKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the Monitoring Setting. Possible values include: + /// 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets error when apply Monitoring Setting changes. + /// + [JsonProperty(PropertyName = "error")] + public Error Error { get; set; } + + /// + /// Gets or sets indicates whether enable the trace functionality + /// + [JsonProperty(PropertyName = "traceEnabled")] + public bool? TraceEnabled { get; set; } + + /// + /// Gets or sets target application insight instrumentation key + /// + [JsonProperty(PropertyName = "appInsightsInstrumentationKey")] + public string AppInsightsInstrumentationKey { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingResource.cs new file mode 100644 index 000000000000..54e763970a40 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingResource.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.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Monitoring Setting resource + /// + public partial class MonitoringSettingResource : ProxyResource + { + /// + /// Initializes a new instance of the MonitoringSettingResource class. + /// + public MonitoringSettingResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MonitoringSettingResource class. + /// + /// Fully qualified resource Id for the + /// resource. + /// The name of the resource. + /// The type of the resource. + /// Properties of the Monitoring Setting + /// resource + public MonitoringSettingResource(string id = default(string), string name = default(string), string type = default(string), MonitoringSettingProperties properties = default(MonitoringSettingProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the Monitoring Setting resource + /// + [JsonProperty(PropertyName = "properties")] + public MonitoringSettingProperties Properties { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProxyState.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingState.cs similarity index 87% rename from sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProxyState.cs rename to sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingState.cs index d9543fafd424..ec34efe482e2 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProxyState.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MonitoringSettingState.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.AppPlatform.Models { /// - /// Defines values for TraceProxyState. + /// Defines values for MonitoringSettingState. /// - public static class TraceProxyState + public static class MonitoringSettingState { public const string NotAvailable = "NotAvailable"; public const string Failed = "Failed"; diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/NetworkProfile.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/NetworkProfile.cs new file mode 100644 index 000000000000..22cf9244ea34 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/NetworkProfile.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service network profile payload + /// + public partial class NetworkProfile + { + /// + /// Initializes a new instance of the NetworkProfile class. + /// + public NetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkProfile class. + /// + /// Fully qualified resource Id of + /// the subnet to host Azure Spring Cloud Service Runtime + /// Fully qualified resource Id of the subnet + /// to host Azure Spring Cloud Apps + /// Azure Spring Cloud service reserved + /// CIDR + /// Name of the + /// resource group containing network resources of Azure Spring Cloud + /// Service Runtime + /// Name of the resource group + /// containing network resources of Azure Spring Cloud Apps + public NetworkProfile(string serviceRuntimeSubnetId = default(string), string appSubnetId = default(string), string serviceCidr = default(string), string serviceRuntimeNetworkResourceGroup = default(string), string appNetworkResourceGroup = default(string)) + { + ServiceRuntimeSubnetId = serviceRuntimeSubnetId; + AppSubnetId = appSubnetId; + ServiceCidr = serviceCidr; + ServiceRuntimeNetworkResourceGroup = serviceRuntimeNetworkResourceGroup; + AppNetworkResourceGroup = appNetworkResourceGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully qualified resource Id of the subnet to host + /// Azure Spring Cloud Service Runtime + /// + [JsonProperty(PropertyName = "serviceRuntimeSubnetId")] + public string ServiceRuntimeSubnetId { get; set; } + + /// + /// Gets or sets fully qualified resource Id of the subnet to host + /// Azure Spring Cloud Apps + /// + [JsonProperty(PropertyName = "appSubnetId")] + public string AppSubnetId { get; set; } + + /// + /// Gets or sets azure Spring Cloud service reserved CIDR + /// + [JsonProperty(PropertyName = "serviceCidr")] + public string ServiceCidr { get; set; } + + /// + /// Gets or sets name of the resource group containing network + /// resources of Azure Spring Cloud Service Runtime + /// + [JsonProperty(PropertyName = "serviceRuntimeNetworkResourceGroup")] + public string ServiceRuntimeNetworkResourceGroup { get; set; } + + /// + /// Gets or sets name of the resource group containing network + /// resources of Azure Spring Cloud Apps + /// + [JsonProperty(PropertyName = "appNetworkResourceGroup")] + public string AppNetworkResourceGroup { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/OperationDetail.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/OperationDetail.cs index e16512ac90be..77b826127b0a 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/OperationDetail.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/OperationDetail.cs @@ -30,15 +30,15 @@ public OperationDetail() /// Initializes a new instance of the OperationDetail class. /// /// Name of the operation - /// Indicates whether the operation is a data - /// action + /// Indicates whether the operation is a + /// data action /// Display of the operation /// Origin of the operation /// Properties of the operation - public OperationDetail(string name = default(string), bool? dataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), OperationProperties properties = default(OperationProperties)) + public OperationDetail(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), OperationProperties properties = default(OperationProperties)) { Name = name; - DataAction = dataAction; + IsDataAction = isDataAction; Display = display; Origin = origin; Properties = properties; @@ -59,8 +59,8 @@ public OperationDetail() /// /// Gets or sets indicates whether the operation is a data action /// - [JsonProperty(PropertyName = "dataAction")] - public bool? DataAction { get; set; } + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } /// /// Gets or sets display of the operation diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSku.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..643cdfc17512 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSku.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes an available Azure Spring Cloud SKU. + /// + public partial class ResourceSku + { + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSku class. + /// + /// Gets the type of resource the SKU + /// applies to. + /// Gets the name of SKU. + /// Gets the tier of SKU. + /// Gets the capacity of SKU. + /// Gets the set of locations that the SKU is + /// available. + /// Gets a list of locations and + /// availability zones in those locations where the SKU is + /// available. + /// Gets the restrictions because of which + /// SKU cannot be used. This is + /// empty if there are no restrictions. + public ResourceSku(string resourceType = default(string), string name = default(string), string tier = default(string), SkuCapacity capacity = default(SkuCapacity), IList locations = default(IList), IList locationInfo = default(IList), IList restrictions = default(IList)) + { + ResourceType = resourceType; + Name = name; + Tier = tier; + Capacity = capacity; + Locations = locations; + LocationInfo = locationInfo; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of resource the SKU applies to. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets the name of SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the tier of SKU. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets the capacity of SKU. + /// + [JsonProperty(PropertyName = "capacity")] + public SkuCapacity Capacity { get; set; } + + /// + /// Gets the set of locations that the SKU is available. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; set; } + + /// + /// Gets a list of locations and availability zones in those locations + /// where the SKU is available. + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; set; } + + /// + /// Gets the restrictions because of which SKU cannot be used. This is + /// empty if there are no restrictions. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Capacity != null) + { + Capacity.Validate(); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuCapabilities.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuCapabilities.cs new file mode 100644 index 000000000000..f69f5581ab72 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuCapabilities.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ResourceSkuCapabilities + { + /// + /// Initializes a new instance of the ResourceSkuCapabilities class. + /// + public ResourceSkuCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuCapabilities class. + /// + /// Gets an invariant to describe the + /// feature. + /// Gets an invariant if the feature is measured by + /// quantity. + public ResourceSkuCapabilities(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets an invariant to describe the feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets an invariant if the feature is measured by quantity. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuLocationInfo.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuLocationInfo.cs new file mode 100644 index 000000000000..eaf0dcd90aa0 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuLocationInfo.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Locations and availability zones where the SKU is available + /// + public partial class ResourceSkuLocationInfo + { + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + public ResourceSkuLocationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + /// Gets location of the SKU + /// Gets list of availability zones where the SKU + /// is supported. + /// Gets details of capabilities available to + /// a SKU in specific zones. + public ResourceSkuLocationInfo(string location = default(string), IList zones = default(IList), IList zoneDetails = default(IList)) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the SKU + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets list of availability zones where the SKU is supported. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets details of capabilities available to a SKU in specific zones. + /// + [JsonProperty(PropertyName = "zoneDetails")] + public IList ZoneDetails { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionInfo.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionInfo.cs new file mode 100644 index 000000000000..ee4924e37bb8 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionInfo.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.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information about the restriction where the SKU cannot be used + /// + public partial class ResourceSkuRestrictionInfo + { + /// + /// Initializes a new instance of the ResourceSkuRestrictionInfo class. + /// + public ResourceSkuRestrictionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuRestrictionInfo class. + /// + /// Gets locations where the SKU is + /// restricted + /// Gets list of availability zones where the SKU + /// is restricted. + public ResourceSkuRestrictionInfo(IList locations = default(IList), IList zones = default(IList)) + { + Locations = locations; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets locations where the SKU is restricted + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; set; } + + /// + /// Gets list of availability zones where the SKU is restricted. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictions.cs new file mode 100644 index 000000000000..4e2f162c4f57 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictions.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Restrictions where the SKU cannot be used + /// + public partial class ResourceSkuRestrictions + { + /// + /// Initializes a new instance of the ResourceSkuRestrictions class. + /// + public ResourceSkuRestrictions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuRestrictions class. + /// + /// Gets the type of restrictions. Possible values + /// include: 'Location', 'Zone' + /// Gets the value of restrictions. If the + /// restriction type is set to + /// location. This would be different locations where the SKU is + /// restricted. + /// Gets the information about the + /// restriction where the SKU cannot be used. + /// Gets the reason for restriction. Possible + /// values include: 'QuotaId', 'NotAvailableForSubscription' + public ResourceSkuRestrictions(string type = default(string), IList values = default(IList), ResourceSkuRestrictionInfo restrictionInfo = default(ResourceSkuRestrictionInfo), string reasonCode = default(string)) + { + Type = type; + Values = values; + RestrictionInfo = restrictionInfo; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of restrictions. Possible values include: 'Location', + /// 'Zone' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets the value of restrictions. If the restriction type is set to + /// location. This would be different locations where the SKU is + /// restricted. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Gets the information about the restriction where the SKU cannot be + /// used. + /// + [JsonProperty(PropertyName = "restrictionInfo")] + public ResourceSkuRestrictionInfo RestrictionInfo { get; set; } + + /// + /// Gets the reason for restriction. Possible values include: + /// 'QuotaId', 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public string ReasonCode { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsReasonCode.cs new file mode 100644 index 000000000000..71f9a2d9aacf --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsReasonCode.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.AppPlatform.Models +{ + + /// + /// Defines values for ResourceSkuRestrictionsReasonCode. + /// + public static class ResourceSkuRestrictionsReasonCode + { + public const string QuotaId = "QuotaId"; + public const string NotAvailableForSubscription = "NotAvailableForSubscription"; + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsType.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsType.cs new file mode 100644 index 000000000000..59a262d94000 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuRestrictionsType.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.AppPlatform.Models +{ + + /// + /// Defines values for ResourceSkuRestrictionsType. + /// + public static class ResourceSkuRestrictionsType + { + public const string Location = "Location"; + public const string Zone = "Zone"; + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuZoneDetails.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuZoneDetails.cs new file mode 100644 index 000000000000..fc1b97fbd3e5 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceSkuZoneDetails.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details of capabilities available to a SKU in specific zones + /// + public partial class ResourceSkuZoneDetails + { + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + public ResourceSkuZoneDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + /// Gets the set of zones that the SKU is available + /// in with the + /// specified capabilities. + /// Gets a list of capabilities that are + /// available for the SKU in the + /// specified list of zones. + public ResourceSkuZoneDetails(IList name = default(IList), IList capabilities = default(IList)) + { + Name = name; + Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of zones that the SKU is available in with the + /// specified capabilities. + /// + [JsonProperty(PropertyName = "name")] + public IList Name { get; set; } + + /// + /// Gets a list of capabilities that are available for the SKU in the + /// specified list of zones. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ServiceResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ServiceResource.cs index f27fa8260b49..ba0252d910d2 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ServiceResource.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ServiceResource.cs @@ -39,10 +39,12 @@ public ServiceResource() /// Tags of the service which is a list of key value /// pairs that describe the resource. /// Properties of the Service resource - public ServiceResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ClusterResourceProperties properties = default(ClusterResourceProperties)) + /// Sku of the Service resource + public ServiceResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ClusterResourceProperties properties = default(ClusterResourceProperties), Sku sku = default(Sku)) : base(id, name, type, location, tags) { Properties = properties; + Sku = sku; CustomInit(); } @@ -58,17 +60,10 @@ public ServiceResource() public ClusterResourceProperties Properties { get; set; } /// - /// Validate the object. + /// Gets or sets sku of the Service resource /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties != null) - { - Properties.Validate(); - } - } + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/Sku.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..d7ba8332ca60 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/Sku.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sku of Azure Spring Cloud + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// Name of the Sku + /// Tier of the Sku + /// Current capacity of the target + /// resource + public Sku(string name = default(string), string tier = default(string), int? capacity = default(int?)) + { + Name = name; + Tier = tier; + Capacity = capacity; + 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; } + + /// + /// Gets or sets tier of the Sku + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets current capacity of the target resource + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuCapacity.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuCapacity.cs new file mode 100644 index 000000000000..aacb62c1713e --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuCapacity.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SKU capacity + /// + public partial class SkuCapacity + { + /// + /// Initializes a new instance of the SkuCapacity class. + /// + public SkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuCapacity class. + /// + /// Gets or sets the minimum. + /// Gets or sets the maximum. + /// Gets or sets the default. + /// Gets or sets the type of the scale. + /// Possible values include: 'None', 'Manual', 'Automatic' + public SkuCapacity(int minimum, int? maximum = default(int?), int? defaultProperty = default(int?), string scaleType = default(string)) + { + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum. + /// + [JsonProperty(PropertyName = "minimum")] + public int Minimum { get; set; } + + /// + /// Gets or sets the maximum. + /// + [JsonProperty(PropertyName = "maximum")] + public int? Maximum { get; set; } + + /// + /// Gets or sets the default. + /// + [JsonProperty(PropertyName = "default")] + public int? DefaultProperty { get; set; } + + /// + /// Gets or sets the type of the scale. Possible values include: + /// 'None', 'Manual', 'Automatic' + /// + [JsonProperty(PropertyName = "scaleType")] + public string ScaleType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuScaleType.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuScaleType.cs new file mode 100644 index 000000000000..014a0edbe099 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SkuScaleType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + + /// + /// Defines values for SkuScaleType. + /// + public static class SkuScaleType + { + public const string None = "None"; + public const string Manual = "Manual"; + public const string Automatic = "Automatic"; + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProperties.cs deleted file mode 100644 index a04c2452b385..000000000000 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/TraceProperties.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.AppPlatform.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Trace properties payload - /// - public partial class TraceProperties - { - /// - /// Initializes a new instance of the TraceProperties class. - /// - public TraceProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TraceProperties class. - /// - /// State of the trace proxy. Possible values - /// include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' - /// Error when apply trace proxy changes. - /// Indicates whether enable the tracing - /// functionality - /// Target application - /// insight instrumentation key - public TraceProperties(string state = default(string), Error error = default(Error), bool? enabled = default(bool?), string appInsightInstrumentationKey = default(string)) - { - State = state; - Error = error; - Enabled = enabled; - AppInsightInstrumentationKey = appInsightInstrumentationKey; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets state of the trace proxy. Possible values include: - /// 'NotAvailable', 'Failed', 'Succeeded', 'Updating' - /// - [JsonProperty(PropertyName = "state")] - public string State { get; private set; } - - /// - /// Gets or sets error when apply trace proxy changes. - /// - [JsonProperty(PropertyName = "error")] - public Error Error { get; set; } - - /// - /// Gets or sets indicates whether enable the tracing functionality - /// - [JsonProperty(PropertyName = "enabled")] - public bool? Enabled { get; set; } - - /// - /// Gets or sets target application insight instrumentation key - /// - [JsonProperty(PropertyName = "appInsightInstrumentationKey")] - public string AppInsightInstrumentationKey { get; set; } - - } -} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperations.cs new file mode 100644 index 000000000000..52b6b52f0898 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperations.cs @@ -0,0 +1,749 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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; + + /// + /// MonitoringSettingsOperations operations. + /// + internal partial class MonitoringSettingsOperations : IServiceOperations, IMonitoringSettingsOperations + { + /// + /// Initializes a new instance of the MonitoringSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MonitoringSettingsOperations(AppPlatformManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AppPlatformManagementClient + /// + public AppPlatformManagementClient Client { get; private set; } + + /// + /// Get the Monitoring Setting and its properties. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdatePutWithHttpMessagesAsync(resourceGroupName, serviceName, monitoringSettingResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdatePatchWithHttpMessagesAsync(resourceGroupName, serviceName, monitoringSettingResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePutWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (monitoringSettingResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitoringSettingResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("monitoringSettingResource", monitoringSettingResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdatePut", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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(monitoringSettingResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(monitoringSettingResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update 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> BeginUpdatePatchWithHttpMessagesAsync(string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (monitoringSettingResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitoringSettingResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("monitoringSettingResource", monitoringSettingResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdatePatch", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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(monitoringSettingResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(monitoringSettingResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..c45f46b590e6 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/MonitoringSettingsOperationsExtensions.cs @@ -0,0 +1,259 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MonitoringSettingsOperations. + /// + public static partial class MonitoringSettingsOperationsExtensions + { + /// + /// Get the Monitoring Setting and its properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + public static MonitoringSettingResource Get(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName) + { + return operations.GetAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Get the Monitoring Setting and its properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static MonitoringSettingResource UpdatePut(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource) + { + return operations.UpdatePutAsync(resourceGroupName, serviceName, monitoringSettingResource).GetAwaiter().GetResult(); + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePutAsync(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePutWithHttpMessagesAsync(resourceGroupName, serviceName, monitoringSettingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static MonitoringSettingResource UpdatePatch(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource) + { + return operations.UpdatePatchAsync(resourceGroupName, serviceName, monitoringSettingResource).GetAwaiter().GetResult(); + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task UpdatePatchAsync(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdatePatchWithHttpMessagesAsync(resourceGroupName, serviceName, monitoringSettingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static MonitoringSettingResource BeginUpdatePut(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource) + { + return operations.BeginUpdatePutAsync(resourceGroupName, serviceName, monitoringSettingResource).GetAwaiter().GetResult(); + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdatePutAsync(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdatePutWithHttpMessagesAsync(resourceGroupName, serviceName, monitoringSettingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + public static MonitoringSettingResource BeginUpdatePatch(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource) + { + return operations.BeginUpdatePatchAsync(resourceGroupName, serviceName, monitoringSettingResource).GetAwaiter().GetResult(); + } + + /// + /// Update the Monitoring Setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the Service resource. + /// + /// + /// Parameters for the update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdatePatchAsync(this IMonitoringSettingsOperations operations, string resourceGroupName, string serviceName, MonitoringSettingResource monitoringSettingResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdatePatchWithHttpMessagesAsync(resourceGroupName, serviceName, monitoringSettingResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SdkInfo_AppPlatformManagementClient.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SdkInfo_AppPlatformManagementClient.cs index a3dc655780c9..8a238937bb27 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SdkInfo_AppPlatformManagementClient.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SdkInfo_AppPlatformManagementClient.cs @@ -19,24 +19,18 @@ public static IEnumerable> ApiInfo_AppPlatformMana { return new Tuple[] { - new Tuple("AppPlatform", "Apps", "2019-05-01-preview"), - new Tuple("AppPlatform", "Bindings", "2019-05-01-preview"), - new Tuple("AppPlatform", "Deployments", "2019-05-01-preview"), - new Tuple("AppPlatform", "Operations", "2019-05-01-preview"), - new Tuple("AppPlatform", "Services", "2019-05-01-preview"), + new Tuple("AppPlatform", "Apps", "2020-07-01"), + new Tuple("AppPlatform", "Bindings", "2020-07-01"), + new Tuple("AppPlatform", "Certificates", "2020-07-01"), + new Tuple("AppPlatform", "ConfigServers", "2020-07-01"), + new Tuple("AppPlatform", "CustomDomains", "2020-07-01"), + new Tuple("AppPlatform", "Deployments", "2020-07-01"), + new Tuple("AppPlatform", "MonitoringSettings", "2020-07-01"), + new Tuple("AppPlatform", "Operations", "2020-07-01"), + new Tuple("AppPlatform", "Services", "2020-07-01"), + new Tuple("AppPlatform", "Skus", "2020-07-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/appplatform/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\projects\\spring-service\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "191aa6f4e91585f08acf453f47817a36f1db9c69"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperations.cs index 32ea5c265bc0..19286c946de6 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperations.cs @@ -262,7 +262,7 @@ internal ServicesOperations(AppPlatformManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, resource, customHeaders, cancellationToken).ConfigureAwait(false); @@ -311,7 +311,7 @@ internal ServicesOperations(AppPlatformManagementClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, resource, customHeaders, cancellationToken).ConfigureAwait(false); @@ -545,12 +545,8 @@ internal ServicesOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> RegenerateTestKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest = default(RegenerateTestKeyRequestPayload), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> RegenerateTestKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (regenerateTestKeyRequest != null) - { - regenerateTestKeyRequest.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -563,6 +559,14 @@ internal ServicesOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); } + if (regenerateTestKeyRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "regenerateTestKeyRequest"); + } + if (regenerateTestKeyRequest != null) + { + regenerateTestKeyRequest.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -570,9 +574,9 @@ internal ServicesOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("regenerateTestKeyRequest", regenerateTestKeyRequest); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("regenerateTestKeyRequest", regenerateTestKeyRequest); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegenerateTestKey", tracingParameters); } @@ -718,6 +722,9 @@ internal ServicesOperations(AppPlatformManagementClient client) return _result; } + /// + /// Disable test endpoint functionality for a Service. + /// /// /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. @@ -887,6 +894,9 @@ internal ServicesOperations(AppPlatformManagementClient client) return _result; } + /// + /// Enable test endpoint functionality for a Service. + /// /// /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. @@ -1109,6 +1119,10 @@ internal ServicesOperations(AppPlatformManagementClient client) /// public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, NameAvailabilityParameters availabilityParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } if (location == null) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); @@ -1121,10 +1135,6 @@ internal ServicesOperations(AppPlatformManagementClient client) { availabilityParameters.Validate(); } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1140,8 +1150,8 @@ internal ServicesOperations(AppPlatformManagementClient client) // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability").ToString(); - _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1670,12 +1680,8 @@ internal ServicesOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resource != null) - { - resource.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1688,6 +1694,10 @@ internal ServicesOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); } + if (resource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1695,9 +1705,9 @@ internal ServicesOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resource", resource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("resource", resource); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1776,7 +1786,7 @@ internal ServicesOperations(AppPlatformManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1854,6 +1864,24 @@ internal ServicesOperations(AppPlatformManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2067,7 +2095,7 @@ internal ServicesOperations(AppPlatformManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -2081,6 +2109,10 @@ internal ServicesOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); } + if (resource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resource"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2088,9 +2120,9 @@ internal ServicesOperations(AppPlatformManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resource", resource); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("resource", resource); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperationsExtensions.cs index bdaf9933f5b6..2d13e568e452 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperationsExtensions.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperationsExtensions.cs @@ -79,7 +79,7 @@ public static ServiceResource Get(this IServicesOperations operations, string re /// /// Parameters for the create or update operation /// - public static ServiceResource CreateOrUpdate(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource)) + public static ServiceResource CreateOrUpdate(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource) { return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, resource).GetAwaiter().GetResult(); } @@ -103,7 +103,7 @@ public static ServiceResource Get(this IServicesOperations operations, string re /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, resource, null, cancellationToken).ConfigureAwait(false)) { @@ -166,7 +166,7 @@ public static void Delete(this IServicesOperations operations, string resourceGr /// /// Parameters for the update operation /// - public static ServiceResource Update(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource)) + public static ServiceResource Update(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource) { return operations.UpdateAsync(resourceGroupName, serviceName, resource).GetAwaiter().GetResult(); } @@ -190,7 +190,7 @@ public static void Delete(this IServicesOperations operations, string resourceGr /// /// The cancellation token. /// - public static async Task UpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, resource, null, cancellationToken).ConfigureAwait(false)) { @@ -256,7 +256,7 @@ public static TestKeys ListTestKeys(this IServicesOperations operations, string /// /// Parameters for the operation /// - public static TestKeys RegenerateTestKey(this IServicesOperations operations, string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest = default(RegenerateTestKeyRequestPayload)) + public static TestKeys RegenerateTestKey(this IServicesOperations operations, string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest) { return operations.RegenerateTestKeyAsync(resourceGroupName, serviceName, regenerateTestKeyRequest).GetAwaiter().GetResult(); } @@ -280,7 +280,7 @@ public static TestKeys ListTestKeys(this IServicesOperations operations, string /// /// The cancellation token. /// - public static async Task RegenerateTestKeyAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest = default(RegenerateTestKeyRequestPayload), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegenerateTestKeyAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, RegenerateTestKeyRequestPayload regenerateTestKeyRequest, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.RegenerateTestKeyWithHttpMessagesAsync(resourceGroupName, serviceName, regenerateTestKeyRequest, null, cancellationToken).ConfigureAwait(false)) { @@ -288,6 +288,9 @@ public static TestKeys ListTestKeys(this IServicesOperations operations, string } } + /// + /// Disable test endpoint functionality for a Service. + /// /// /// The operations group for this extension method. /// @@ -303,6 +306,9 @@ public static void DisableTestEndpoint(this IServicesOperations operations, stri operations.DisableTestEndpointAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); } + /// + /// Disable test endpoint functionality for a Service. + /// /// /// The operations group for this extension method. /// @@ -321,6 +327,9 @@ public static void DisableTestEndpoint(this IServicesOperations operations, stri (await operations.DisableTestEndpointWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Enable test endpoint functionality for a Service. + /// /// /// The operations group for this extension method. /// @@ -336,6 +345,9 @@ public static TestKeys EnableTestEndpoint(this IServicesOperations operations, s return operations.EnableTestEndpointAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); } + /// + /// Enable test endpoint functionality for a Service. + /// /// /// The operations group for this extension method. /// @@ -477,7 +489,7 @@ public static IPage List(this IServicesOperations operations, s /// /// Parameters for the create or update operation /// - public static ServiceResource BeginCreateOrUpdate(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource)) + public static ServiceResource BeginCreateOrUpdate(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource) { return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, resource).GetAwaiter().GetResult(); } @@ -501,7 +513,7 @@ public static IPage List(this IServicesOperations operations, s /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, resource, null, cancellationToken).ConfigureAwait(false)) { @@ -564,7 +576,7 @@ public static void BeginDelete(this IServicesOperations operations, string resou /// /// Parameters for the update operation /// - public static ServiceResource BeginUpdate(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource)) + public static ServiceResource BeginUpdate(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource) { return operations.BeginUpdateAsync(resourceGroupName, serviceName, resource).GetAwaiter().GetResult(); } @@ -588,7 +600,7 @@ public static void BeginDelete(this IServicesOperations operations, string resou /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource = default(ServiceResource), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, ServiceResource resource, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, resource, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperations.cs new file mode 100644 index 000000000000..7726ca624a7d --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperations.cs @@ -0,0 +1,401 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + 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; + + /// + /// SkusOperations operations. + /// + internal partial class SkusOperations : IServiceOperations, ISkusOperations + { + /// + /// Initializes a new instance of the SkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SkusOperations(AppPlatformManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AppPlatformManagementClient + /// + public AppPlatformManagementClient Client { get; private set; } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus").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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperationsExtensions.cs new file mode 100644 index 000000000000..bb9d40e7bf97 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/SkusOperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SkusOperations. + /// + public static partial class SkusOperationsExtensions + { + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISkusOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISkusOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// 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 ISkusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}