diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DistributedAvailabilityGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DistributedAvailabilityGroupsOperations.cs
deleted file mode 100644
index 9b1a283e74ef..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DistributedAvailabilityGroupsOperations.cs
+++ /dev/null
@@ -1,1351 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- 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;
-
- ///
- /// DistributedAvailabilityGroupsOperations operations.
- ///
- internal partial class DistributedAvailabilityGroupsOperations : IServiceOperations, IDistributedAvailabilityGroupsOperations
- {
- ///
- /// Initializes a new instance of the DistributedAvailabilityGroupsOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal DistributedAvailabilityGroupsOperations(SqlManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the SqlManagementClient
- ///
- public SqlManagementClient Client { get; private set; }
-
- ///
- /// Gets a list of a distributed availability groups in 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 managed instance.
- ///
- ///
- /// 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>> ListByInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", 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.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse>();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Gets a distributed availability group info.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (distributedAvailabilityGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "distributedAvailabilityGroupName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("distributedAvailabilityGroupName", distributedAvailabilityGroupName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{distributedAvailabilityGroupName}", System.Uri.EscapeDataString(distributedAvailabilityGroupName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Creates a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send Request
- AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Creates a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// 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 managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (distributedAvailabilityGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "distributedAvailabilityGroupName");
- }
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("distributedAvailabilityGroupName", distributedAvailabilityGroupName);
- tracingParameters.Add("parameters", parameters);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{distributedAvailabilityGroupName}", System.Uri.EscapeDataString(distributedAvailabilityGroupName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 201 && (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);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (distributedAvailabilityGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "distributedAvailabilityGroupName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("distributedAvailabilityGroupName", distributedAvailabilityGroupName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{distributedAvailabilityGroupName}", System.Uri.EscapeDataString(distributedAvailabilityGroupName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("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;
- }
-
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (distributedAvailabilityGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "distributedAvailabilityGroupName");
- }
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("distributedAvailabilityGroupName", distributedAvailabilityGroupName);
- tracingParameters.Add("parameters", parameters);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{distributedAvailabilityGroupName}", System.Uri.EscapeDataString(distributedAvailabilityGroupName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PATCH");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 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);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Gets a list of a distributed availability groups in 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>> ListByInstanceNextWithHttpMessagesAsync(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, "ListByInstanceNext", 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/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DistributedAvailabilityGroupsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DistributedAvailabilityGroupsOperationsExtensions.cs
deleted file mode 100644
index bdb1e8e9118c..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DistributedAvailabilityGroupsOperationsExtensions.cs
+++ /dev/null
@@ -1,463 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for DistributedAvailabilityGroupsOperations.
- ///
- public static partial class DistributedAvailabilityGroupsOperationsExtensions
- {
- ///
- /// Gets a list of a distributed availability groups in 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 managed instance.
- ///
- public static IPage ListByInstance(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName)
- {
- return operations.ListByInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets a list of a distributed availability groups in 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 managed instance.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListByInstanceAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListByInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Gets a distributed availability group info.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- public static DistributedAvailabilityGroup Get(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName)
- {
- return operations.GetAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets a distributed availability group info.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Creates a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- public static DistributedAvailabilityGroup CreateOrUpdate(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters)
- {
- return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Creates a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateOrUpdateAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- public static void Delete(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName)
- {
- operations.DeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName).GetAwaiter().GetResult();
- }
-
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- public static DistributedAvailabilityGroup Update(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters)
- {
- return operations.UpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task UpdateAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Creates a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- public static DistributedAvailabilityGroup BeginCreateOrUpdate(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters)
- {
- return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Creates a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginCreateOrUpdateAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- public static void BeginDelete(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName)
- {
- operations.BeginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName).GetAwaiter().GetResult();
- }
-
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginDeleteAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- public static DistributedAvailabilityGroup BeginUpdate(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters)
- {
- return operations.BeginUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginUpdateAsync(this IDistributedAvailabilityGroupsOperations operations, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Gets a list of a distributed availability groups in instance.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- public static IPage ListByInstanceNext(this IDistributedAvailabilityGroupsOperations operations, string nextPageLink)
- {
- return operations.ListByInstanceNextAsync(nextPageLink).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets a list of a distributed availability groups in 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> ListByInstanceNextAsync(this IDistributedAvailabilityGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListByInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs
index ec38ff3120aa..785f56f27acb 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs
@@ -504,7 +504,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, long? skip = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
@@ -518,7 +518,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2021-08-01-preview";
+ string apiVersion = "2020-11-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -725,7 +725,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2021-08-01-preview";
+ string apiVersion = "2020-11-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1050,7 +1050,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2021-08-01-preview";
+ string apiVersion = "2020-11-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1276,7 +1276,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2021-08-01-preview";
+ string apiVersion = "2020-11-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1469,7 +1469,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2021-08-01-preview";
+ string apiVersion = "2020-11-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1677,7 +1677,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2021-08-01-preview";
+ string apiVersion = "2020-11-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs
index 5cda2f80dc17..c7e88cca78b5 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperationsExtensions.cs
@@ -141,7 +141,7 @@ public static IEnumerable ListMetricDefinitions(this IElasticP
///
/// The number of elements in the collection to skip.
///
- public static IPage ListByServer(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, long? skip = default(long?))
+ public static IPage ListByServer(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, int? skip = default(int?))
{
return operations.ListByServerAsync(resourceGroupName, serverName, skip).GetAwaiter().GetResult();
}
@@ -165,7 +165,7 @@ public static IEnumerable ListMetricDefinitions(this IElasticP
///
/// The cancellation token.
///
- public static async Task> ListByServerAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, long? skip = default(long?), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListByServerAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, skip, null, cancellationToken).ConfigureAwait(false))
{
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDistributedAvailabilityGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDistributedAvailabilityGroupsOperations.cs
deleted file mode 100644
index 458f57dedb5d..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDistributedAvailabilityGroupsOperations.cs
+++ /dev/null
@@ -1,296 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// DistributedAvailabilityGroupsOperations operations.
- ///
- public partial interface IDistributedAvailabilityGroupsOperations
- {
- ///
- /// Gets a list of a distributed availability groups in 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 managed instance.
- ///
- ///
- /// 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>> ListByInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Gets a distributed availability group info.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Creates a distributed availability group between Sql On-Prem and
- /// Sql Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// 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 managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Creates a distributed availability group between Sql On-Prem and
- /// Sql Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// 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 managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Drops a distributed availability group between Sql On-Prem and Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Updates a distributed availability group replication mode.
- ///
- ///
- /// 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 managed instance.
- ///
- ///
- /// The distributed availability group name.
- ///
- ///
- /// The distributed availability group info.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Gets a list of a distributed availability groups in 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>> ListByInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs
index a005ae944885..baeaed569f92 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IElasticPoolsOperations.cs
@@ -116,7 +116,7 @@ public partial interface IElasticPoolsOperations
///
/// Thrown when a required parameter is null
///
- Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, long? skip = default(long?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets an elastic pool.
///
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs
deleted file mode 100644
index b083f7fbd36b..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IIPv6FirewallRulesOperations.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// IPv6FirewallRulesOperations operations.
- ///
- public partial interface IIPv6FirewallRulesOperations
- {
- ///
- /// Gets an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// 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 serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Creates or updates an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// The required parameters for creating or updating an IPv6 firewall
- /// rule.
- ///
- ///
- /// 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 serverName, string firewallRuleName, IPv6FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Deletes an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// 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 serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs
deleted file mode 100644
index a11276bd290d..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperations.cs
+++ /dev/null
@@ -1,1045 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- 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;
-
- ///
- /// IPv6FirewallRulesOperations operations.
- ///
- internal partial class IPv6FirewallRulesOperations : IServiceOperations, IIPv6FirewallRulesOperations
- {
- ///
- /// Initializes a new instance of the IPv6FirewallRulesOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal IPv6FirewallRulesOperations(SqlManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the SqlManagementClient
- ///
- public SqlManagementClient Client { get; private set; }
-
- ///
- /// Gets an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// 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 serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (serverName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
- }
- if (firewallRuleName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-08-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("firewallRuleName", firewallRuleName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Creates or updates an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// The required parameters for creating or updating an IPv6 firewall rule.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (serverName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
- }
- if (firewallRuleName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName");
- }
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-08-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("firewallRuleName", firewallRuleName);
- tracingParameters.Add("parameters", parameters);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 201)
- {
- var ex = new 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);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Deletes an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (serverName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
- }
- if (firewallRuleName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-08-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("firewallRuleName", firewallRuleName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("DELETE");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 204)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (serverName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-08-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.Sql/servers/{serverName}/ipv6FirewallRules").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex = new CloudException(_errorBody.Message);
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse>();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs
deleted file mode 100644
index e632d77599d7..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IPv6FirewallRulesOperationsExtensions.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for IPv6FirewallRulesOperations.
- ///
- public static partial class IPv6FirewallRulesOperationsExtensions
- {
- ///
- /// Gets an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- public static IPv6FirewallRule Get(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName)
- {
- return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Creates or updates an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// The required parameters for creating or updating an IPv6 firewall rule.
- ///
- public static IPv6FirewallRule CreateOrUpdate(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters)
- {
- return operations.CreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Creates or updates an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// The required parameters for creating or updating an IPv6 firewall rule.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateOrUpdateAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, IPv6FirewallRule parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Deletes an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- public static void Delete(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName)
- {
- operations.DeleteAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult();
- }
-
- ///
- /// Deletes an IPv6 firewall rule.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The name of the firewall rule.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// 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 server.
- ///
- public static IPage ListByServer(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName)
- {
- return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// 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 server.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListByServerAsync(this IIPv6FirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- public static IPage ListByServerNext(this IIPv6FirewallRulesOperations operations, string nextPageLink)
- {
- return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets a list of IPv6 firewall rules.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListByServerNextAsync(this IIPv6FirewallRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerTrustCertificatesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerTrustCertificatesOperations.cs
deleted file mode 100644
index b1c9bfe90233..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerTrustCertificatesOperations.cs
+++ /dev/null
@@ -1,235 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// ServerTrustCertificatesOperations operations.
- ///
- public partial interface IServerTrustCertificatesOperations
- {
- ///
- /// Gets a server trust certificate that was uploaded from box to Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to get.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Uploads a server trust certificate from box to Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// Name of of the certificate to upload.
- ///
- ///
- /// The server trust certificate info.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, ServerTrustCertificate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Deletes a server trust certificate that was uploaded from box to
- /// Sql Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to delete.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Gets a list of the server trust certificates which are used for
- /// secure communication between SQL On-Prem instance and the given Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// 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>> ListByInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Uploads a server trust certificate from box to Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// Name of of the certificate to upload.
- ///
- ///
- /// The server trust certificate info.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, ServerTrustCertificate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Deletes a server trust certificate that was uploaded from box to
- /// Sql Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to delete.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Gets a list of the server trust certificates which are used for
- /// secure communication between SQL On-Prem instance and the given Sql
- /// Managed 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>> ListByInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs
index 3b58b88bad90..32c01fd60c91 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs
@@ -657,20 +657,5 @@ public partial interface ISqlManagementClient : System.IDisposable
///
IServerConnectionPoliciesOperations ServerConnectionPolicies { get; }
- ///
- /// Gets the IDistributedAvailabilityGroupsOperations.
- ///
- IDistributedAvailabilityGroupsOperations DistributedAvailabilityGroups { get; }
-
- ///
- /// Gets the IServerTrustCertificatesOperations.
- ///
- IServerTrustCertificatesOperations ServerTrustCertificates { get; }
-
- ///
- /// Gets the IIPv6FirewallRulesOperations.
- ///
- IIPv6FirewallRulesOperations IPv6FirewallRules { get; }
-
}
}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DistributedAvailabilityGroup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DistributedAvailabilityGroup.cs
deleted file mode 100644
index a725e9c14f50..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DistributedAvailabilityGroup.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql.Models
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Serialization;
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// Distributed availability group between box and Sql Managed Instance.
- ///
- [Rest.Serialization.JsonTransformation]
- public partial class DistributedAvailabilityGroup : ProxyResource
- {
- ///
- /// Initializes a new instance of the DistributedAvailabilityGroup
- /// class.
- ///
- public DistributedAvailabilityGroup()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the DistributedAvailabilityGroup
- /// class.
- ///
- /// Resource ID.
- /// Resource name.
- /// Resource type.
- /// The name of the target
- /// database
- /// The source endpoint
- /// The primary availability
- /// group name
- /// The secondary
- /// availability group name
- /// The replication mode of a distributed
- /// availability group. Parameter will be ignored during link creation.
- /// Possible values include: 'Async', 'Sync'
- /// The distributed
- /// availability group id
- /// The source replica id
- /// The target replica id
- /// The link state
- /// The last hardened lsn
- public DistributedAvailabilityGroup(string id = default(string), string name = default(string), string type = default(string), string targetDatabase = default(string), string sourceEndpoint = default(string), string primaryAvailabilityGroupName = default(string), string secondaryAvailabilityGroupName = default(string), string replicationMode = default(string), System.Guid? distributedAvailabilityGroupId = default(System.Guid?), System.Guid? sourceReplicaId = default(System.Guid?), System.Guid? targetReplicaId = default(System.Guid?), string linkState = default(string), string lastHardenedLsn = default(string))
- : base(id, name, type)
- {
- TargetDatabase = targetDatabase;
- SourceEndpoint = sourceEndpoint;
- PrimaryAvailabilityGroupName = primaryAvailabilityGroupName;
- SecondaryAvailabilityGroupName = secondaryAvailabilityGroupName;
- ReplicationMode = replicationMode;
- DistributedAvailabilityGroupId = distributedAvailabilityGroupId;
- SourceReplicaId = sourceReplicaId;
- TargetReplicaId = targetReplicaId;
- LinkState = linkState;
- LastHardenedLsn = lastHardenedLsn;
- CustomInit();
- }
-
- ///
- /// An initialization method that performs custom operations like setting defaults
- ///
- partial void CustomInit();
-
- ///
- /// Gets or sets the name of the target database
- ///
- [JsonProperty(PropertyName = "properties.targetDatabase")]
- public string TargetDatabase { get; set; }
-
- ///
- /// Gets or sets the source endpoint
- ///
- [JsonProperty(PropertyName = "properties.sourceEndpoint")]
- public string SourceEndpoint { get; set; }
-
- ///
- /// Gets or sets the primary availability group name
- ///
- [JsonProperty(PropertyName = "properties.primaryAvailabilityGroupName")]
- public string PrimaryAvailabilityGroupName { get; set; }
-
- ///
- /// Gets or sets the secondary availability group name
- ///
- [JsonProperty(PropertyName = "properties.secondaryAvailabilityGroupName")]
- public string SecondaryAvailabilityGroupName { get; set; }
-
- ///
- /// Gets or sets the replication mode of a distributed availability
- /// group. Parameter will be ignored during link creation. Possible
- /// values include: 'Async', 'Sync'
- ///
- [JsonProperty(PropertyName = "properties.replicationMode")]
- public string ReplicationMode { get; set; }
-
- ///
- /// Gets the distributed availability group id
- ///
- [JsonProperty(PropertyName = "properties.distributedAvailabilityGroupId")]
- public System.Guid? DistributedAvailabilityGroupId { get; private set; }
-
- ///
- /// Gets the source replica id
- ///
- [JsonProperty(PropertyName = "properties.sourceReplicaId")]
- public System.Guid? SourceReplicaId { get; private set; }
-
- ///
- /// Gets the target replica id
- ///
- [JsonProperty(PropertyName = "properties.targetReplicaId")]
- public System.Guid? TargetReplicaId { get; private set; }
-
- ///
- /// Gets the link state
- ///
- [JsonProperty(PropertyName = "properties.linkState")]
- public string LinkState { get; private set; }
-
- ///
- /// Gets the last hardened lsn
- ///
- [JsonProperty(PropertyName = "properties.lastHardenedLsn")]
- public string LastHardenedLsn { get; private set; }
-
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPool.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPool.cs
index 269330c135ba..4ff5f68e841a 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPool.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPool.cs
@@ -70,10 +70,7 @@ public ElasticPool()
/// Maintenance configuration
/// id assigned to the elastic pool. This configuration defines the
/// period when the maintenance updates will will occur.
- /// The number of secondary
- /// replicas associated with the elastic pool that are used to provide
- /// high availability.
- public ElasticPool(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string state = default(string), System.DateTime? creationDate = default(System.DateTime?), long? maxSizeBytes = default(long?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), int? highAvailabilityReplicaCount = default(int?))
+ public ElasticPool(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string state = default(string), System.DateTime? creationDate = default(System.DateTime?), long? maxSizeBytes = default(long?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string))
: base(location, id, name, type, tags)
{
Sku = sku;
@@ -85,7 +82,6 @@ public ElasticPool()
ZoneRedundant = zoneRedundant;
LicenseType = licenseType;
MaintenanceConfigurationId = maintenanceConfigurationId;
- HighAvailabilityReplicaCount = highAvailabilityReplicaCount;
CustomInit();
}
@@ -168,13 +164,6 @@ public ElasticPool()
[JsonProperty(PropertyName = "properties.maintenanceConfigurationId")]
public string MaintenanceConfigurationId { get; set; }
- ///
- /// Gets or sets the number of secondary replicas associated with the
- /// elastic pool that are used to provide high availability.
- ///
- [JsonProperty(PropertyName = "properties.highAvailabilityReplicaCount")]
- public int? HighAvailabilityReplicaCount { get; set; }
-
///
/// Validate the object.
///
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolUpdate.cs
index dd5ba1822f2f..8f6468917e99 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolUpdate.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolUpdate.cs
@@ -47,12 +47,8 @@ public ElasticPoolUpdate()
/// Maintenance configuration
/// id assigned to the elastic pool. This configuration defines the
/// period when the maintenance updates will will occur.
- /// The number of secondary
- /// replicas associated with the elastic pool that are used to provide
- /// high availability. Applicable only to Hyperscale elastic
- /// pools.
/// Resource tags.
- public ElasticPoolUpdate(Sku sku = default(Sku), long? maxSizeBytes = default(long?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), int? highAvailabilityReplicaCount = default(int?), IDictionary tags = default(IDictionary))
+ public ElasticPoolUpdate(Sku sku = default(Sku), long? maxSizeBytes = default(long?), ElasticPoolPerDatabaseSettings perDatabaseSettings = default(ElasticPoolPerDatabaseSettings), bool? zoneRedundant = default(bool?), string licenseType = default(string), string maintenanceConfigurationId = default(string), IDictionary tags = default(IDictionary))
{
Sku = sku;
MaxSizeBytes = maxSizeBytes;
@@ -60,7 +56,6 @@ public ElasticPoolUpdate()
ZoneRedundant = zoneRedundant;
LicenseType = licenseType;
MaintenanceConfigurationId = maintenanceConfigurationId;
- HighAvailabilityReplicaCount = highAvailabilityReplicaCount;
Tags = tags;
CustomInit();
}
@@ -111,14 +106,6 @@ public ElasticPoolUpdate()
[JsonProperty(PropertyName = "properties.maintenanceConfigurationId")]
public string MaintenanceConfigurationId { get; set; }
- ///
- /// Gets or sets the number of secondary replicas associated with the
- /// elastic pool that are used to provide high availability. Applicable
- /// only to Hyperscale elastic pools.
- ///
- [JsonProperty(PropertyName = "properties.highAvailabilityReplicaCount")]
- public int? HighAvailabilityReplicaCount { get; set; }
-
///
/// Gets or sets resource tags.
///
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRule.cs
deleted file mode 100644
index c116d7967306..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRule.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql.Models
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Serialization;
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// An IPv6 server firewall rule.
- ///
- [Rest.Serialization.JsonTransformation]
- public partial class IPv6FirewallRule : ProxyResourceWithWritableName
- {
- ///
- /// Initializes a new instance of the IPv6FirewallRule class.
- ///
- public IPv6FirewallRule()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the IPv6FirewallRule class.
- ///
- /// Resource ID.
- /// Resource name.
- /// Resource type.
- /// The start IP address of the firewall
- /// rule. Must be IPv6 format.
- /// The end IP address of the firewall
- /// rule. Must be IPv6 format. Must be greater than or equal to
- /// startIpAddress.
- public IPv6FirewallRule(string id = default(string), string name = default(string), string type = default(string), string startIPv6Address = default(string), string endIPv6Address = default(string))
- : base(id, name, type)
- {
- StartIPv6Address = startIPv6Address;
- EndIPv6Address = endIPv6Address;
- CustomInit();
- }
-
- ///
- /// An initialization method that performs custom operations like setting defaults
- ///
- partial void CustomInit();
-
- ///
- /// Gets or sets the start IP address of the firewall rule. Must be
- /// IPv6 format.
- ///
- [JsonProperty(PropertyName = "properties.startIPv6Address")]
- public string StartIPv6Address { get; set; }
-
- ///
- /// Gets or sets the end IP address of the firewall rule. Must be IPv6
- /// format. Must be greater than or equal to startIpAddress.
- ///
- [JsonProperty(PropertyName = "properties.endIPv6Address")]
- public string EndIPv6Address { get; set; }
-
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRuleList.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRuleList.cs
deleted file mode 100644
index 9797c1a9fdc4..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IPv6FirewallRuleList.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql.Models
-{
- using Newtonsoft.Json;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
-
- ///
- /// A list of IPv6 server firewall rules.
- ///
- public partial class IPv6FirewallRuleList
- {
- ///
- /// Initializes a new instance of the IPv6FirewallRuleList class.
- ///
- public IPv6FirewallRuleList()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the IPv6FirewallRuleList class.
- ///
- public IPv6FirewallRuleList(IList values = default(IList))
- {
- Values = values;
- CustomInit();
- }
-
- ///
- /// An initialization method that performs custom operations like setting defaults
- ///
- partial void CustomInit();
-
- ///
- ///
- [JsonProperty(PropertyName = "values")]
- public IList Values { get; set; }
-
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationMode.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationMode.cs
deleted file mode 100644
index 9cc7e975f49d..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ReplicationMode.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql.Models
-{
-
- ///
- /// Defines values for ReplicationMode.
- ///
- public static class ReplicationMode
- {
- public const string Async = "Async";
- public const string Sync = "Sync";
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerTrustCertificate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerTrustCertificate.cs
deleted file mode 100644
index 3d1f009f1431..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerTrustCertificate.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql.Models
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Serialization;
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// Server trust certificate imported from box to enable connection between
- /// box and Sql Managed Instance.
- ///
- [Rest.Serialization.JsonTransformation]
- public partial class ServerTrustCertificate : ProxyResource
- {
- ///
- /// Initializes a new instance of the ServerTrustCertificate class.
- ///
- public ServerTrustCertificate()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the ServerTrustCertificate class.
- ///
- /// Resource ID.
- /// Resource name.
- /// Resource type.
- /// The certificate public blob
- /// The certificate thumbprint
- /// The certificate name
- public ServerTrustCertificate(string id = default(string), string name = default(string), string type = default(string), string publicBlob = default(string), string thumbprint = default(string), string certificateName = default(string))
- : base(id, name, type)
- {
- PublicBlob = publicBlob;
- Thumbprint = thumbprint;
- CertificateName = certificateName;
- CustomInit();
- }
-
- ///
- /// An initialization method that performs custom operations like setting defaults
- ///
- partial void CustomInit();
-
- ///
- /// Gets or sets the certificate public blob
- ///
- [JsonProperty(PropertyName = "properties.publicBlob")]
- public string PublicBlob { get; set; }
-
- ///
- /// Gets the certificate thumbprint
- ///
- [JsonProperty(PropertyName = "properties.thumbprint")]
- public string Thumbprint { get; private set; }
-
- ///
- /// Gets the certificate name
- ///
- [JsonProperty(PropertyName = "properties.certificateName")]
- public string CertificateName { get; private set; }
-
- }
-}
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs
index 6aa7b16405ce..06364cca2574 100644
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs
+++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs
@@ -41,19 +41,17 @@ public static IEnumerable> ApiInfo_SqlManagementCl
new Tuple("Sql", "Databases", "2014-04-01"),
new Tuple("Sql", "Databases", "2021-05-01-preview"),
new Tuple("Sql", "DeletedServers", "2020-11-01-preview"),
- new Tuple("Sql", "DistributedAvailabilityGroups", "2021-05-01-preview"),
new Tuple("Sql", "ElasticPoolActivities", "2014-04-01"),
new Tuple("Sql", "ElasticPoolDatabaseActivities", "2014-04-01"),
new Tuple("Sql", "ElasticPoolOperations", "2020-11-01-preview"),
new Tuple("Sql", "ElasticPools", "2014-04-01"),
- new Tuple("Sql", "ElasticPools", "2021-08-01-preview"),
+ new Tuple("Sql", "ElasticPools", "2020-11-01-preview"),
new Tuple("Sql", "EncryptionProtectors", "2020-11-01-preview"),
new Tuple("Sql", "ExtendedDatabaseBlobAuditingPolicies", "2020-11-01-preview"),
new Tuple("Sql", "ExtendedServerBlobAuditingPolicies", "2020-11-01-preview"),
new Tuple("Sql", "FailoverGroups", "2020-11-01-preview"),
new Tuple("Sql", "FirewallRules", "2020-11-01-preview"),
new Tuple("Sql", "GeoBackupPolicies", "2014-04-01"),
- new Tuple("Sql", "IPv6FirewallRules", "2021-08-01-preview"),
new Tuple("Sql", "InstanceFailoverGroups", "2020-11-01-preview"),
new Tuple("Sql", "InstancePools", "2020-11-01-preview"),
new Tuple("Sql", "JobAgents", "2020-11-01-preview"),
@@ -124,7 +122,6 @@ public static IEnumerable> ApiInfo_SqlManagementCl
new Tuple("Sql", "ServerKeys", "2020-11-01-preview"),
new Tuple("Sql", "ServerOperations", "2020-11-01-preview"),
new Tuple("Sql", "ServerSecurityAlertPolicies", "2020-11-01-preview"),
- new Tuple("Sql", "ServerTrustCertificates", "2021-05-01-preview"),
new Tuple("Sql", "ServerTrustGroups", "2020-11-01-preview"),
new Tuple("Sql", "ServerUsages", "2014-04-01"),
new Tuple("Sql", "ServerVulnerabilityAssessments", "2020-11-01-preview"),
@@ -146,16 +143,5 @@ public static IEnumerable> ApiInfo_SqlManagementCl
}.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/main/specification/sql/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\\azure-sdk-for-net\\sdk";
- public static readonly String GithubForkName = "Azure";
- public static readonly String GithubBranchName = "main";
- public static readonly String GithubCommidId = "3f59f46d112c58cb8f6231732e88848f0f97872c";
- public static readonly String CodeGenerationErrors = "";
- public static readonly String GithubRepoName = "azure-rest-api-specs";
- // END: Code Generation Metadata Section
}
}
-
diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustCertificatesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustCertificatesOperations.cs
deleted file mode 100644
index e495c28d80ea..000000000000
--- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustCertificatesOperations.cs
+++ /dev/null
@@ -1,1107 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Sql
-{
- 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;
-
- ///
- /// ServerTrustCertificatesOperations operations.
- ///
- internal partial class ServerTrustCertificatesOperations : IServiceOperations, IServerTrustCertificatesOperations
- {
- ///
- /// Initializes a new instance of the ServerTrustCertificatesOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal ServerTrustCertificatesOperations(SqlManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the SqlManagementClient
- ///
- public SqlManagementClient Client { get; private set; }
-
- ///
- /// Gets a server trust certificate that was uploaded from box to Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// Name of of the certificate to get.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (certificateName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "certificateName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("certificateName", certificateName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("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;
- }
-
- ///
- /// Uploads a server trust certificate from box to Sql Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to upload.
- ///
- ///
- /// The server trust certificate info.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string certificateName, ServerTrustCertificate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, certificateName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Deletes a server trust certificate that was uploaded from box to Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to delete.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string certificateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, certificateName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Gets a list of the server trust certificates which are used for secure
- /// communication between SQL On-Prem instance and the given Sql Managed
- /// 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 managed instance.
- ///
- ///
- /// 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>> ListByInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListByInstance", 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.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("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;
- }
-
- ///
- /// Uploads a server trust certificate from box to Sql Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to upload.
- ///
- ///
- /// The server trust certificate info.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, ServerTrustCertificate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (resourceGroupName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
- }
- if (managedInstanceName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName");
- }
- if (certificateName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "certificateName");
- }
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (Client.SubscriptionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
- string apiVersion = "2021-05-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("managedInstanceName", managedInstanceName);
- tracingParameters.Add("certificateName", certificateName);
- tracingParameters.Add("parameters", parameters);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}").ToString();
- _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName));
- _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- List _queryParameters = new List();
- if (apiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 201 && (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);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Deletes a server trust certificate that was uploaded from box to Sql
- /// Managed 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 managed instance.
- ///
- ///
- /// Name of of the certificate to delete.
- ///
- ///
- /// 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 managedInstanceName, string certificateName, Dictionary