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 4a15e9467b6cd..78b11608fb32f 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppPlatformManagementClient.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/AppPlatformManagementClient.cs @@ -101,6 +101,11 @@ public partial class AppPlatformManagementClient : ServiceClient public virtual IBindingsOperations Bindings { get; private set; } + /// + /// Gets the IStoragesOperations. + /// + public virtual IStoragesOperations Storages { get; private set; } + /// /// Gets the ICertificatesOperations. /// @@ -377,6 +382,7 @@ private void Initialize() MonitoringSettings = new MonitoringSettingsOperations(this); Apps = new AppsOperations(this); Bindings = new BindingsOperations(this); + Storages = new StoragesOperations(this); Certificates = new CertificatesOperations(this); CustomDomains = new CustomDomainsOperations(this); Deployments = new DeploymentsOperations(this); @@ -384,7 +390,7 @@ private void Initialize() RuntimeVersions = new RuntimeVersionsOperations(this); Skus = new SkusOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-11-01-preview"; + ApiVersion = "2021-09-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -413,6 +419,12 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("storageType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("storageType")); CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs index c635a33ec0b5a..83901ed4af3c4 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/CertificatesOperations.cs @@ -592,10 +592,6 @@ internal CertificatesOperations(AppPlatformManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "certificateResource"); } - if (certificateResource != null) - { - certificateResource.Validate(); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; 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 0df629d4f2bfd..92f2da3bf95c9 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperations.cs @@ -1127,6 +1127,102 @@ internal DeploymentsOperations(AppPlatformManagementClient client) return _result; } + /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task GenerateHeapDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGenerateHeapDumpWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task GenerateThreadDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginGenerateThreadDumpWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartJFRWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartJFRWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Create a new Deployment or update an exiting Deployment. /// @@ -2457,6 +2553,651 @@ internal DeploymentsOperations(AppPlatformManagementClient client) return _result; } + /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 BeginGenerateHeapDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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"); + } + if (diagnosticParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diagnosticParameters"); + } + // 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("diagnosticParameters", diagnosticParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGenerateHeapDump", 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}/generateHeapDump").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diagnosticParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diagnosticParameters, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 BeginGenerateThreadDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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"); + } + if (diagnosticParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diagnosticParameters"); + } + // 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("diagnosticParameters", diagnosticParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGenerateThreadDump", 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}/generateThreadDump").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diagnosticParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diagnosticParameters, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 BeginStartJFRWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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"); + } + if (diagnosticParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diagnosticParameters"); + } + // 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("diagnosticParameters", diagnosticParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartJFR", 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}/StartJFR").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(diagnosticParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diagnosticParameters, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Handles requests to list all resources in an App. /// 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 cf1c0897f7660..dcef5b07d672f 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperationsExtensions.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/DeploymentsOperationsExtensions.cs @@ -557,6 +557,177 @@ public static LogFileUrlResponse GetLogFileUrl(this IDeploymentsOperations opera } } + /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + public static void GenerateHeapDump(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters) + { + operations.GenerateHeapDumpAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters).GetAwaiter().GetResult(); + } + + /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The cancellation token. + /// + public static async Task GenerateHeapDumpAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GenerateHeapDumpWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + public static void GenerateThreadDump(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters) + { + operations.GenerateThreadDumpAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters).GetAwaiter().GetResult(); + } + + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The cancellation token. + /// + public static async Task GenerateThreadDumpAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GenerateThreadDumpWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + public static void StartJFR(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters) + { + operations.StartJFRAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters).GetAwaiter().GetResult(); + } + + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The cancellation token. + /// + public static async Task StartJFRAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartJFRWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Create a new Deployment or update an exiting Deployment. /// @@ -881,6 +1052,177 @@ public static void BeginRestart(this IDeploymentsOperations operations, string r (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + public static void BeginGenerateHeapDump(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters) + { + operations.BeginGenerateHeapDumpAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters).GetAwaiter().GetResult(); + } + + /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginGenerateHeapDumpAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginGenerateHeapDumpWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + public static void BeginGenerateThreadDump(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters) + { + operations.BeginGenerateThreadDumpAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters).GetAwaiter().GetResult(); + } + + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginGenerateThreadDumpAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginGenerateThreadDumpWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + public static void BeginStartJFR(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters) + { + operations.BeginStartJFRAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters).GetAwaiter().GetResult(); + } + + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartJFRAsync(this IDeploymentsOperations operations, string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartJFRWithHttpMessagesAsync(resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Handles requests to list all resources in an App. /// 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 84ed9a85a56e2..3354b5d9e35e7 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppPlatformManagementClient.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IAppPlatformManagementClient.cs @@ -96,6 +96,11 @@ public partial interface IAppPlatformManagementClient : System.IDisposable /// IBindingsOperations Bindings { get; } + /// + /// Gets the IStoragesOperations. + /// + IStoragesOperations Storages { get; } + /// /// Gets the ICertificatesOperations. /// 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 3fccb3e518fb9..629e28fc9c8c1 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IDeploymentsOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IDeploymentsOperations.cs @@ -345,6 +345,105 @@ public partial interface IDeploymentsOperations /// Task> GetLogFileUrlWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 GenerateHeapDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 GenerateThreadDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 StartJFRWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create a new Deployment or update an exiting Deployment. /// /// @@ -537,6 +636,105 @@ public partial interface IDeploymentsOperations /// Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Generate Heap Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 BeginGenerateHeapDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generate Thread Dump + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 BeginGenerateThreadDumpWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start JFR + /// + /// + /// 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. + /// + /// + /// Parameters for the diagnostic operation + /// + /// + /// 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 BeginStartJFRWithHttpMessagesAsync(string resourceGroupName, string serviceName, string appName, string deploymentName, DiagnosticParameters diagnosticParameters, 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/IServicesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs index f47680e5ee371..632692a0d778f 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IServicesOperations.cs @@ -243,6 +243,54 @@ public partial interface IServicesOperations /// Task> EnableTestEndpointWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Stop 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. + /// + /// + /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start 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. + /// + /// + /// 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 StartWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Checks that the resource name is valid and is not already in use. /// /// @@ -395,6 +443,54 @@ public partial interface IServicesOperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, ServiceResource resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Stop 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. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Start 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. + /// + /// + /// 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 BeginStartWithHttpMessagesAsync(string resourceGroupName, string serviceName, 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/IStoragesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IStoragesOperations.cs new file mode 100644 index 0000000000000..51586923f5fd1 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/IStoragesOperations.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; + + /// + /// StoragesOperations operations. + /// + public partial interface IStoragesOperations + { + /// + /// Get the storage 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 storage 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 storageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update storage 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 storage 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 storageName, StorageResource storageResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the storage 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 storage 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 storageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// 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 storage 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 storage 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 storageName, StorageResource storageResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the storage 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 storage 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 storageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// 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/AppResourceProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AppResourceProperties.cs index 767c5c0bc5499..cde012884e51b 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 @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.AppPlatform.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -43,9 +45,13 @@ public AppResourceProperties() /// created /// Temporary disk settings /// Persistent disk settings + /// List of custom persistent + /// disks /// Indicate if end to end TLS is /// enabled. - 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), bool? enableEndToEndTLS = default(bool?)) + /// Collection of loaded + /// certificates + 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), IList customPersistentDisks = default(IList), bool? enableEndToEndTLS = default(bool?), IList loadedCertificates = default(IList)) { PublicProperty = publicProperty; Url = url; @@ -56,7 +62,9 @@ public AppResourceProperties() CreatedTime = createdTime; TemporaryDisk = temporaryDisk; PersistentDisk = persistentDisk; + CustomPersistentDisks = customPersistentDisks; EnableEndToEndTLS = enableEndToEndTLS; + LoadedCertificates = loadedCertificates; CustomInit(); } @@ -120,12 +128,24 @@ public AppResourceProperties() [JsonProperty(PropertyName = "persistentDisk")] public PersistentDisk PersistentDisk { get; set; } + /// + /// Gets or sets list of custom persistent disks + /// + [JsonProperty(PropertyName = "customPersistentDisks")] + public IList CustomPersistentDisks { get; set; } + /// /// Gets or sets indicate if end to end TLS is enabled. /// [JsonProperty(PropertyName = "enableEndToEndTLS")] public bool? EnableEndToEndTLS { get; set; } + /// + /// Gets or sets collection of loaded certificates + /// + [JsonProperty(PropertyName = "loadedCertificates")] + public IList LoadedCertificates { get; set; } + /// /// Validate the object. /// @@ -142,6 +162,26 @@ public virtual void Validate() { PersistentDisk.Validate(); } + if (CustomPersistentDisks != null) + { + foreach (var element in CustomPersistentDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + if (LoadedCertificates != null) + { + foreach (var element1 in LoadedCertificates) + { + if (element1 != null) + { + element1.Validate(); + } + } + } } } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AzureFileVolume.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AzureFileVolume.cs new file mode 100644 index 0000000000000..8582e86a9bb63 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/AzureFileVolume.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// The properties of the Azure File volume. Azure File shares are mounted + /// as volumes. + /// + public partial class AzureFileVolume : CustomPersistentDiskProperties + { + /// + /// Initializes a new instance of the AzureFileVolume class. + /// + public AzureFileVolume() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureFileVolume class. + /// + /// The mount path of the persistent + /// disk. + /// The share name of the Azure File + /// share. + /// Indicates whether the persistent + /// disk is a readonly one. + /// These are the mount options for a + /// persistent disk. + public AzureFileVolume(string mountPath, string shareName, bool? readonlyProperty = default(bool?), IList mountOptions = default(IList)) + : base(mountPath, readonlyProperty, mountOptions) + { + ShareName = shareName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the share name of the Azure File share. + /// + [JsonProperty(PropertyName = "shareName")] + public string ShareName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ShareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ShareName"); + } + } + } +} 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 index 1c329b6185760..7213309859c75 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateProperties.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateProperties.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,12 +31,7 @@ public CertificateProperties() /// /// 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 @@ -46,12 +40,9 @@ public CertificateProperties() /// 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)) + public CertificateProperties(string thumbprint = 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; @@ -72,24 +63,6 @@ public CertificateProperties() [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. /// @@ -126,22 +99,5 @@ public CertificateProperties() [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 index 7b5989b76c865..e85535026a929 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateResource.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CertificateResource.cs @@ -53,18 +53,5 @@ public CertificateResource() [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 e0b7a369e8924..2ce4473182b8b 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 @@ -37,12 +37,15 @@ public ClusterResourceProperties() /// Version of the Service /// ServiceInstanceEntity GUID which uniquely /// identifies a created resource - public ClusterResourceProperties(string provisioningState = default(string), NetworkProfile networkProfile = default(NetworkProfile), int? version = default(int?), string serviceId = default(string)) + /// Power state of the Service. Possible + /// values include: 'Running', 'Stopped' + public ClusterResourceProperties(string provisioningState = default(string), NetworkProfile networkProfile = default(NetworkProfile), int? version = default(int?), string serviceId = default(string), string powerState = default(string)) { ProvisioningState = provisioningState; NetworkProfile = networkProfile; Version = version; ServiceId = serviceId; + PowerState = powerState; CustomInit(); } @@ -78,5 +81,12 @@ public ClusterResourceProperties() [JsonProperty(PropertyName = "serviceId")] public string ServiceId { get; private set; } + /// + /// Gets power state of the Service. Possible values include: + /// 'Running', 'Stopped' + /// + [JsonProperty(PropertyName = "powerState")] + public string PowerState { get; private set; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ContentCertificateProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ContentCertificateProperties.cs new file mode 100644 index 0000000000000..065b91ac6632e --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ContentCertificateProperties.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of certificate imported from key vault. + /// + [Newtonsoft.Json.JsonObject("ContentCertificate")] + public partial class ContentCertificateProperties : CertificateProperties + { + /// + /// Initializes a new instance of the ContentCertificateProperties + /// class. + /// + public ContentCertificateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentCertificateProperties + /// class. + /// + /// The content of uploaded certificate. + /// The thumbprint of certificate. + /// 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 ContentCertificateProperties(string content, string thumbprint = 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)) + : base(thumbprint, issuer, issuedDate, expirationDate, activateDate, subjectName, dnsNames) + { + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the content of uploaded certificate. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Content == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Content"); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CreatedByType.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..cd5e84ec3e966 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomContainer.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomContainer.cs new file mode 100644 index 0000000000000..ac4385b152c61 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomContainer.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// Custom container payload + /// + public partial class CustomContainer + { + /// + /// Initializes a new instance of the CustomContainer class. + /// + public CustomContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomContainer class. + /// + /// The name of the registry that contains the + /// container image + /// Container image of the custom + /// container. This should be in the form of + /// <repository>:<tag> without the server name of the + /// registry + /// Entrypoint array. Not executed within a + /// shell. The docker image's ENTRYPOINT is used if this is not + /// provided. + /// Arguments to the entrypoint. The docker image's + /// CMD is used if this is not provided. + /// Credential of the image + /// registry + public CustomContainer(string server = default(string), string containerImage = default(string), IList command = default(IList), IList args = default(IList), ImageRegistryCredential imageRegistryCredential = default(ImageRegistryCredential)) + { + Server = server; + ContainerImage = containerImage; + Command = command; + Args = args; + ImageRegistryCredential = imageRegistryCredential; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the registry that contains the container + /// image + /// + [JsonProperty(PropertyName = "server")] + public string Server { get; set; } + + /// + /// Gets or sets container image of the custom container. This should + /// be in the form of &lt;repository&gt;:&lt;tag&gt; + /// without the server name of the registry + /// + [JsonProperty(PropertyName = "containerImage")] + public string ContainerImage { get; set; } + + /// + /// Gets or sets entrypoint array. Not executed within a shell. The + /// docker image's ENTRYPOINT is used if this is not provided. + /// + [JsonProperty(PropertyName = "command")] + public IList Command { get; set; } + + /// + /// Gets or sets arguments to the entrypoint. The docker image's CMD is + /// used if this is not provided. + /// + [JsonProperty(PropertyName = "args")] + public IList Args { get; set; } + + /// + /// Gets or sets credential of the image registry + /// + [JsonProperty(PropertyName = "imageRegistryCredential")] + public ImageRegistryCredential ImageRegistryCredential { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomPersistentDiskProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomPersistentDiskProperties.cs new file mode 100644 index 0000000000000..35433938bf115 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomPersistentDiskProperties.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Custom persistent disk resource payload. + /// + public partial class CustomPersistentDiskProperties + { + /// + /// Initializes a new instance of the CustomPersistentDiskProperties + /// class. + /// + public CustomPersistentDiskProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomPersistentDiskProperties + /// class. + /// + /// The mount path of the persistent + /// disk. + /// Indicates whether the persistent + /// disk is a readonly one. + /// These are the mount options for a + /// persistent disk. + public CustomPersistentDiskProperties(string mountPath, bool? readonlyProperty = default(bool?), IList mountOptions = default(IList)) + { + MountPath = mountPath; + ReadonlyProperty = readonlyProperty; + MountOptions = mountOptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the mount path of the persistent disk. + /// + [JsonProperty(PropertyName = "mountPath")] + public string MountPath { get; set; } + + /// + /// Gets or sets indicates whether the persistent disk is a readonly + /// one. + /// + [JsonProperty(PropertyName = "readonly")] + public bool? ReadonlyProperty { get; set; } + + /// + /// Gets or sets these are the mount options for a persistent disk. + /// + [JsonProperty(PropertyName = "mountOptions")] + public IList MountOptions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MountPath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MountPath"); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomPersistentDiskResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomPersistentDiskResource.cs new file mode 100644 index 0000000000000..0eae2c700076e --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/CustomPersistentDiskResource.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Custom persistent disk resource payload. + /// + public partial class CustomPersistentDiskResource + { + /// + /// Initializes a new instance of the CustomPersistentDiskResource + /// class. + /// + public CustomPersistentDiskResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomPersistentDiskResource + /// class. + /// + /// The resource id of Azure Spring Cloud + /// Storage resource. + /// Properties of the + /// custom persistent disk resource payload. + public CustomPersistentDiskResource(string storageId, CustomPersistentDiskProperties customPersistentDiskProperties = default(CustomPersistentDiskProperties)) + { + CustomPersistentDiskProperties = customPersistentDiskProperties; + StorageId = storageId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the custom persistent disk resource + /// payload. + /// + [JsonProperty(PropertyName = "customPersistentDiskProperties")] + public CustomPersistentDiskProperties CustomPersistentDiskProperties { get; set; } + + /// + /// Gets or sets the resource id of Azure Spring Cloud Storage + /// resource. + /// + [JsonProperty(PropertyName = "storageId")] + public string StorageId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageId"); + } + if (CustomPersistentDiskProperties != null) + { + CustomPersistentDiskProperties.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 232e2fb3c3e0e..6a1266519bcaf 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 @@ -31,11 +31,19 @@ public DeploymentSettings() /// /// Initializes a new instance of the DeploymentSettings class. /// - /// 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) + /// Required CPU. This should be 1 for Basic tier, + /// and in range [1, 4] for Standard tier. This is deprecated starting + /// from API version 2021-09-01-preview. Please use the + /// resourceRequests field to set the CPU size. + /// Required Memory size in GB. This should be + /// in range [1, 2] for Basic tier, and in range [1, 8] for Standard + /// tier. This is deprecated starting from API version + /// 2021-09-01-preview. Please use the resourceRequests field to set + /// the the memory size. + /// The requested resource quantity for + /// required CPU and Memory. It is recommended that using this field to + /// represent the required CPU and Memory, the old field cpu and + /// memoryInGB will be deprecated later. /// JVM parameter /// The path to the .NET executable /// relative to zip root @@ -43,10 +51,11 @@ public DeploymentSettings() /// variables /// Runtime version. Possible values /// include: 'Java_8', 'Java_11', 'NetCore_31' - public DeploymentSettings(int? cpu = default(int?), int? memoryInGB = default(int?), string jvmOptions = default(string), string netCoreMainEntryPath = default(string), IDictionary environmentVariables = default(IDictionary), string runtimeVersion = default(string)) + public DeploymentSettings(int? cpu = default(int?), int? memoryInGB = default(int?), ResourceRequests resourceRequests = default(ResourceRequests), string jvmOptions = default(string), string netCoreMainEntryPath = default(string), IDictionary environmentVariables = default(IDictionary), string runtimeVersion = default(string)) { Cpu = cpu; MemoryInGB = memoryInGB; + ResourceRequests = resourceRequests; JvmOptions = jvmOptions; NetCoreMainEntryPath = netCoreMainEntryPath; EnvironmentVariables = environmentVariables; @@ -60,19 +69,32 @@ public DeploymentSettings() partial void CustomInit(); /// - /// Gets or sets required CPU, basic tier should be 1, standard tier - /// should be in range (1, 4) + /// Gets or sets required CPU. This should be 1 for Basic tier, and in + /// range [1, 4] for Standard tier. This is deprecated starting from + /// API version 2021-09-01-preview. Please use the resourceRequests + /// field to set the CPU size. /// [JsonProperty(PropertyName = "cpu")] public int? Cpu { get; set; } /// - /// Gets or sets required Memory size in GB, basic tier should be in - /// range (1, 2), standard tier should be in range (1, 8) + /// Gets or sets required Memory size in GB. This should be in range + /// [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This + /// is deprecated starting from API version 2021-09-01-preview. Please + /// use the resourceRequests field to set the the memory size. /// [JsonProperty(PropertyName = "memoryInGB")] public int? MemoryInGB { get; set; } + /// + /// Gets or sets the requested resource quantity for required CPU and + /// Memory. It is recommended that using this field to represent the + /// required CPU and Memory, the old field cpu and memoryInGB will be + /// deprecated later. + /// + [JsonProperty(PropertyName = "resourceRequests")] + public ResourceRequests ResourceRequests { get; set; } + /// /// Gets or sets JVM parameter /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DiagnosticParameters.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DiagnosticParameters.cs new file mode 100644 index 0000000000000..c90dd3052d492 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/DiagnosticParameters.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; + + /// + /// Diagnostic parameters of diagnostic operations + /// + public partial class DiagnosticParameters + { + /// + /// Initializes a new instance of the DiagnosticParameters class. + /// + public DiagnosticParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticParameters class. + /// + /// App instance name + /// Your target file path in your own + /// BYOS + /// Duration of your JFR. 1 min can be + /// represented by 1m or 60s. + public DiagnosticParameters(string appInstance = default(string), string filePath = default(string), string duration = default(string)) + { + AppInstance = appInstance; + FilePath = filePath; + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets app instance name + /// + [JsonProperty(PropertyName = "appInstance")] + public string AppInstance { get; set; } + + /// + /// Gets or sets your target file path in your own BYOS + /// + [JsonProperty(PropertyName = "filePath")] + public string FilePath { get; set; } + + /// + /// Gets or sets duration of your JFR. 1 min can be represented by 1m + /// or 60s. + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ImageRegistryCredential.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ImageRegistryCredential.cs new file mode 100644 index 0000000000000..34fbb2416a19a --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ImageRegistryCredential.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Credential of the image registry + /// + public partial class ImageRegistryCredential + { + /// + /// Initializes a new instance of the ImageRegistryCredential class. + /// + public ImageRegistryCredential() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageRegistryCredential class. + /// + /// The username of the image registry + /// credential + /// The password of the image registry + /// credential + public ImageRegistryCredential(string username = default(string), string password = default(string)) + { + Username = username; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the username of the image registry credential + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets the password of the image registry credential + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/KeyVaultCertificateProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/KeyVaultCertificateProperties.cs new file mode 100644 index 0000000000000..ff7eb9757666b --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/KeyVaultCertificateProperties.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of certificate imported from key vault. + /// + [Newtonsoft.Json.JsonObject("KeyVaultCertificate")] + public partial class KeyVaultCertificateProperties : CertificateProperties + { + /// + /// Initializes a new instance of the KeyVaultCertificateProperties + /// class. + /// + public KeyVaultCertificateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultCertificateProperties + /// class. + /// + /// The vault uri of user key vault. + /// The certificate name of key + /// vault. + /// The thumbprint of certificate. + /// 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. + /// The certificate version of key + /// vault. + /// Optional. If set to true, it will + /// not import private key from key vault. + public KeyVaultCertificateProperties(string vaultUri, string keyVaultCertName, string thumbprint = 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), string certVersion = default(string), bool? excludePrivateKey = default(bool?)) + : base(thumbprint, issuer, issuedDate, expirationDate, activateDate, subjectName, dnsNames) + { + VaultUri = vaultUri; + KeyVaultCertName = keyVaultCertName; + CertVersion = certVersion; + ExcludePrivateKey = excludePrivateKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// 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 or sets optional. If set to true, it will not import private + /// key from key vault. + /// + [JsonProperty(PropertyName = "excludePrivateKey")] + public bool? ExcludePrivateKey { get; 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/LoadedCertificate.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/LoadedCertificate.cs new file mode 100644 index 0000000000000..39fa9cf9094b8 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/LoadedCertificate.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Loaded certificate payload + /// + public partial class LoadedCertificate + { + /// + /// Initializes a new instance of the LoadedCertificate class. + /// + public LoadedCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadedCertificate class. + /// + /// Resource Id of loaded certificate + /// Indicate whether the certificate will + /// be loaded into default trust store, only work for Java + /// runtime. + public LoadedCertificate(string resourceId, bool? loadTrustStore = default(bool?)) + { + ResourceId = resourceId; + LoadTrustStore = loadTrustStore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id of loaded certificate + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets indicate whether the certificate will be loaded into + /// default trust store, only work for Java runtime. + /// + [JsonProperty(PropertyName = "loadTrustStore")] + public bool? LoadTrustStore { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricDimension.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricDimension.cs index fdc2fb7a54fb3..49558951bf890 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricDimension.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricDimension.cs @@ -32,10 +32,13 @@ public MetricDimension() /// Name of the dimension /// Localized friendly display name of the /// dimension - public MetricDimension(string name = default(string), string displayName = default(string)) + /// Whether this dimension should + /// be included for the Shoebox export scenario + public MetricDimension(string name = default(string), string displayName = default(string), bool? toBeExportedForShoebox = default(bool?)) { Name = name; DisplayName = displayName; + ToBeExportedForShoebox = toBeExportedForShoebox; CustomInit(); } @@ -56,5 +59,12 @@ public MetricDimension() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } + /// + /// Gets or sets whether this dimension should be included for the + /// Shoebox export scenario + /// + [JsonProperty(PropertyName = "toBeExportedForShoebox")] + public bool? ToBeExportedForShoebox { get; set; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricSpecification.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricSpecification.cs index af8c417e3e73b..0812559d2ed8e 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricSpecification.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/MetricSpecification.cs @@ -50,7 +50,9 @@ public MetricSpecification() /// will be returned for time duration where no metric is /// emitted/published. /// Dimensions of the metric - public MetricSpecification(string name = default(string), string displayName = default(string), string displayDescription = default(string), string unit = default(string), string category = default(string), string aggregationType = default(string), IList supportedAggregationTypes = default(IList), IList supportedTimeGrainTypes = default(IList), bool? fillGapWithZero = default(bool?), IList dimensions = default(IList)) + /// Name of the MDM namespace. + /// Optional. + public MetricSpecification(string name = default(string), string displayName = default(string), string displayDescription = default(string), string unit = default(string), string category = default(string), string aggregationType = default(string), IList supportedAggregationTypes = default(IList), IList supportedTimeGrainTypes = default(IList), bool? fillGapWithZero = default(bool?), IList dimensions = default(IList), string sourceMdmNamespace = default(string)) { Name = name; DisplayName = displayName; @@ -62,6 +64,7 @@ public MetricSpecification() SupportedTimeGrainTypes = supportedTimeGrainTypes; FillGapWithZero = fillGapWithZero; Dimensions = dimensions; + SourceMdmNamespace = sourceMdmNamespace; CustomInit(); } @@ -133,5 +136,11 @@ public MetricSpecification() [JsonProperty(PropertyName = "dimensions")] public IList Dimensions { get; set; } + /// + /// Gets or sets name of the MDM namespace. Optional. + /// + [JsonProperty(PropertyName = "sourceMdmNamespace")] + public string SourceMdmNamespace { get; set; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/PowerState.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/PowerState.cs new file mode 100644 index 0000000000000..f0bb7f4ac84b7 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/PowerState.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 PowerState. + /// + public static class PowerState + { + public const string Running = "Running"; + public const string Stopped = "Stopped"; + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceRequests.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceRequests.cs new file mode 100644 index 0000000000000..6aef9de763358 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/ResourceRequests.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.Linq; + + /// + /// Deployment resource request payload + /// + public partial class ResourceRequests + { + /// + /// Initializes a new instance of the ResourceRequests class. + /// + public ResourceRequests() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceRequests class. + /// + /// Required CPU. 1 core can be represented by 1 or + /// 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, + /// 4} for Standard tier. + /// Required memory. 1 GB can be represented by + /// 1Gi or 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and + /// {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + public ResourceRequests(string cpu = default(string), string memory = default(string)) + { + Cpu = cpu; + Memory = memory; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets required CPU. 1 core can be represented by 1 or 1000m. + /// This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for + /// Standard tier. + /// + [JsonProperty(PropertyName = "cpu")] + public string Cpu { get; set; } + + /// + /// Gets or sets required memory. 1 GB can be represented by 1Gi or + /// 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and + /// {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + /// + [JsonProperty(PropertyName = "memory")] + public string Memory { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageAccount.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageAccount.cs new file mode 100644 index 0000000000000..ee173ca3668df --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageAccount.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// storage resource of type Azure Storage Account. + /// + public partial class StorageAccount : StorageProperties + { + /// + /// Initializes a new instance of the StorageAccount class. + /// + public StorageAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageAccount class. + /// + /// The account name of the Azure Storage + /// Account. + /// The account key of the Azure Storage + /// Account. + public StorageAccount(string accountName, string accountKey) + { + AccountName = accountName; + AccountKey = accountKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the account name of the Azure Storage Account. + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets the account key of the Azure Storage Account. + /// + [JsonProperty(PropertyName = "accountKey")] + public string AccountKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccountName"); + } + if (AccountKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccountKey"); + } + } + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageProperties.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageProperties.cs new file mode 100644 index 0000000000000..b10e158d9ddf9 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageProperties.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 System.Linq; + + /// + /// Storage resource payload. + /// + public partial class StorageProperties + { + /// + /// Initializes a new instance of the StorageProperties class. + /// + public StorageProperties() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageResource.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageResource.cs new file mode 100644 index 0000000000000..52a5d42ba106c --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/StorageResource.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.Linq; + + /// + /// Storage resource payload. + /// + public partial class StorageResource : ProxyResource + { + /// + /// Initializes a new instance of the StorageResource class. + /// + public StorageResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageResource class. + /// + /// Fully qualified resource Id for the + /// resource. + /// The name of the resource. + /// The type of the resource. + /// Properties of the storage resource + /// payload. + public StorageResource(string id = default(string), string name = default(string), string type = default(string), StorageProperties properties = default(StorageProperties), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the storage resource payload. + /// + [JsonProperty(PropertyName = "properties")] + public StorageProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SystemData.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..c73866db9bbce --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AppPlatform.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceInfo.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceInfo.cs index 134ca697d8a25..3ab4eeb928b0e 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceInfo.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceInfo.cs @@ -30,19 +30,21 @@ public UserSourceInfo() /// Initializes a new instance of the UserSourceInfo class. /// /// Type of the source uploaded. Possible values - /// include: 'Jar', 'NetCoreZip', 'Source' + /// include: 'Jar', 'NetCoreZip', 'Source', 'Container' /// Relative path of the storage which /// stores the source /// Version of the source /// Selector for the artifact to be used /// for the deployment for multi-module projects. This should be /// the relative path to the target module/project. - public UserSourceInfo(string type = default(string), string relativePath = default(string), string version = default(string), string artifactSelector = default(string)) + /// Custom container payload + public UserSourceInfo(string type = default(string), string relativePath = default(string), string version = default(string), string artifactSelector = default(string), CustomContainer customContainer = default(CustomContainer)) { Type = type; RelativePath = relativePath; Version = version; ArtifactSelector = artifactSelector; + CustomContainer = customContainer; CustomInit(); } @@ -53,7 +55,7 @@ public UserSourceInfo() /// /// Gets or sets type of the source uploaded. Possible values include: - /// 'Jar', 'NetCoreZip', 'Source' + /// 'Jar', 'NetCoreZip', 'Source', 'Container' /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } @@ -78,5 +80,11 @@ public UserSourceInfo() [JsonProperty(PropertyName = "artifactSelector")] public string ArtifactSelector { get; set; } + /// + /// Gets or sets custom container payload + /// + [JsonProperty(PropertyName = "customContainer")] + public CustomContainer CustomContainer { get; set; } + } } diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceType.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceType.cs index 278fdb334cb3a..ad3f0d3a43732 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceType.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/Models/UserSourceType.cs @@ -19,5 +19,6 @@ public static class UserSourceType public const string Jar = "Jar"; public const string NetCoreZip = "NetCoreZip"; public const string Source = "Source"; + public const string Container = "Container"; } } 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 97bd291e7cf68..2a312dd855e06 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,30 +19,20 @@ public static IEnumerable> ApiInfo_AppPlatformMana { return new Tuple[] { - new Tuple("AppPlatform", "Apps", "2020-11-01-preview"), - new Tuple("AppPlatform", "Bindings", "2020-11-01-preview"), - new Tuple("AppPlatform", "Certificates", "2020-11-01-preview"), - new Tuple("AppPlatform", "ConfigServers", "2020-11-01-preview"), - new Tuple("AppPlatform", "CustomDomains", "2020-11-01-preview"), - new Tuple("AppPlatform", "Deployments", "2020-11-01-preview"), - new Tuple("AppPlatform", "MonitoringSettings", "2020-11-01-preview"), - new Tuple("AppPlatform", "Operations", "2020-11-01-preview"), - new Tuple("AppPlatform", "RuntimeVersions", "2020-11-01-preview"), - new Tuple("AppPlatform", "Services", "2020-11-01-preview"), - new Tuple("AppPlatform", "Skus", "2020-11-01-preview"), + new Tuple("AppPlatform", "Apps", "2021-09-01-preview"), + new Tuple("AppPlatform", "Bindings", "2021-09-01-preview"), + new Tuple("AppPlatform", "Certificates", "2021-09-01-preview"), + new Tuple("AppPlatform", "ConfigServers", "2021-09-01-preview"), + new Tuple("AppPlatform", "CustomDomains", "2021-09-01-preview"), + new Tuple("AppPlatform", "Deployments", "2021-09-01-preview"), + new Tuple("AppPlatform", "MonitoringSettings", "2021-09-01-preview"), + new Tuple("AppPlatform", "Operations", "2021-09-01-preview"), + new Tuple("AppPlatform", "RuntimeVersions", "2021-09-01-preview"), + new Tuple("AppPlatform", "Services", "2021-09-01-preview"), + new Tuple("AppPlatform", "Skus", "2021-09-01-preview"), + new Tuple("AppPlatform", "Storages", "2021-09-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - 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=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Users\\sonwan\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "a06d912bc912010bdc0aa5d1d3c4b28ee1d89905"; - 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 4757e1a17d8cc..e36be683ae36e 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperations.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperations.cs @@ -1142,6 +1142,52 @@ internal ServicesOperations(AppPlatformManagementClient client) return _result; } + /// + /// Stop 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, serviceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Start 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, serviceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Checks that the resource name is valid and is not already in use. /// @@ -2407,6 +2453,372 @@ internal ServicesOperations(AppPlatformManagementClient client) return _result; } + /// + /// Stop 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. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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, "BeginStop", 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}/stop").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 404 && (int)_statusCode != 409) + { + 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; + } + + /// + /// Start 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. + /// + /// + /// 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 BeginStartWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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, "BeginStart", 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}/start").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 404 && (int)_statusCode != 409) + { + 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; + } + /// /// Handles requests to list all resources in a subscription. /// 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 2d13e568e4522..bbecfc042c30f 100644 --- a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperationsExtensions.cs +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/ServicesOperationsExtensions.cs @@ -369,6 +369,84 @@ public static TestKeys EnableTestEndpoint(this IServicesOperations operations, s } } + /// + /// Stop a Service. + /// + /// + /// 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 void Stop(this IServicesOperations operations, string resourceGroupName, string serviceName) + { + operations.StopAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Stop a Service. + /// + /// + /// 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 StopAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start a Service. + /// + /// + /// 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 void Start(this IServicesOperations operations, string resourceGroupName, string serviceName) + { + operations.StartAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Start a Service. + /// + /// + /// 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 StartAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Checks that the resource name is valid and is not already in use. /// @@ -608,6 +686,84 @@ public static ServiceResource BeginUpdate(this IServicesOperations operations, s } } + /// + /// Stop a Service. + /// + /// + /// 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 void BeginStop(this IServicesOperations operations, string resourceGroupName, string serviceName) + { + operations.BeginStopAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Stop a Service. + /// + /// + /// 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 BeginStopAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Start a Service. + /// + /// + /// 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 void BeginStart(this IServicesOperations operations, string resourceGroupName, string serviceName) + { + operations.BeginStartAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Start a Service. + /// + /// + /// 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 BeginStartAsync(this IServicesOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Handles requests to list all resources in a subscription. /// diff --git a/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/StoragesOperations.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/StoragesOperations.cs new file mode 100644 index 0000000000000..a8287115a66ab --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/StoragesOperations.cs @@ -0,0 +1,1154 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// StoragesOperations operations. + /// + internal partial class StoragesOperations : IServiceOperations, IStoragesOperations + { + /// + /// Initializes a new instance of the StoragesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal StoragesOperations(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 storage 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 storage 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 storageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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 (storageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageName"); + } + // 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("storageName", storageName); + 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}/storages/{storageName}").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("{storageName}", System.Uri.EscapeDataString(storageName)); + 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 storage 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 storage 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 storageName, StorageResource storageResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, storageResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete the storage 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 storage resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string storageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// 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.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (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}/storages").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 storage 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 storage 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 storageName, StorageResource storageResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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 (storageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageName"); + } + if (storageResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageResource"); + } + // 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("storageName", storageName); + tracingParameters.Add("storageResource", storageResource); + 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}/storages/{storageName}").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("{storageName}", System.Uri.EscapeDataString(storageName)); + 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(storageResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(storageResource, 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 storage 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 storage 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 storageName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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 (storageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageName"); + } + // 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("storageName", storageName); + 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}/storages/{storageName}").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("{storageName}", System.Uri.EscapeDataString(storageName)); + 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 storages of one Azure Spring Cloud instance. + /// + /// + /// 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/StoragesOperationsExtensions.cs b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/StoragesOperationsExtensions.cs new file mode 100644 index 0000000000000..0e7daffc7dd08 --- /dev/null +++ b/sdk/appplatform/Microsoft.Azure.Management.AppPlatform/src/Generated/StoragesOperationsExtensions.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 StoragesOperations. + /// + public static partial class StoragesOperationsExtensions + { + /// + /// Get the storage 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 storage resource. + /// + public static StorageResource Get(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName) + { + return operations.GetAsync(resourceGroupName, serviceName, storageName).GetAwaiter().GetResult(); + } + + /// + /// Get the storage 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 storage resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update storage 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 storage resource. + /// + /// + /// Parameters for the create or update operation + /// + public static StorageResource CreateOrUpdate(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, StorageResource storageResource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, storageName, storageResource).GetAwaiter().GetResult(); + } + + /// + /// Create or update storage 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 storage resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, StorageResource storageResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, storageResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the storage 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 storage resource. + /// + public static void Delete(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName) + { + operations.DeleteAsync(resourceGroupName, serviceName, storageName).GetAwaiter().GetResult(); + } + + /// + /// Delete the storage 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 storage resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// 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 IStoragesOperations operations, string resourceGroupName, string serviceName) + { + return operations.ListAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// 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 IStoragesOperations 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 storage 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 storage resource. + /// + /// + /// Parameters for the create or update operation + /// + public static StorageResource BeginCreateOrUpdate(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, StorageResource storageResource) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, storageName, storageResource).GetAwaiter().GetResult(); + } + + /// + /// Create or update storage 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 storage resource. + /// + /// + /// Parameters for the create or update operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, StorageResource storageResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, storageResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the storage 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 storage resource. + /// + public static void BeginDelete(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName) + { + operations.BeginDeleteAsync(resourceGroupName, serviceName, storageName).GetAwaiter().GetResult(); + } + + /// + /// Delete the storage 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 storage resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IStoragesOperations operations, string resourceGroupName, string serviceName, string storageName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serviceName, storageName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IStoragesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the storages of one Azure Spring Cloud instance. + /// + /// + /// 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 IStoragesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}