diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs new file mode 100644 index 0000000000000..daa45565791c6 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperations.cs @@ -0,0 +1,1084 @@ +// +// 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.AzureArcData +{ + 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; + + /// + /// ActiveDirectoryConnectorsOperations operations. + /// + internal partial class ActiveDirectoryConnectorsOperations : IServiceOperations, IActiveDirectoryConnectorsOperations + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ActiveDirectoryConnectorsOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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> GetWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (activeDirectoryConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "activeDirectoryConnectorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("activeDirectoryConnectorName", activeDirectoryConnectorName); + 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.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + _url = _url.Replace("{activeDirectoryConnectorName}", System.Uri.EscapeDataString(activeDirectoryConnectorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (activeDirectoryConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "activeDirectoryConnectorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + ActiveDirectoryConnectorResource activeDirectoryConnectorResource = new ActiveDirectoryConnectorResource(); + if (properties != null) + { + activeDirectoryConnectorResource.Properties = properties; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("activeDirectoryConnectorName", activeDirectoryConnectorName); + tracingParameters.Add("activeDirectoryConnectorResource", activeDirectoryConnectorResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + _url = _url.Replace("{activeDirectoryConnectorName}", System.Uri.EscapeDataString(activeDirectoryConnectorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(activeDirectoryConnectorResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activeDirectoryConnectorResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// 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 dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (activeDirectoryConnectorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "activeDirectoryConnectorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("activeDirectoryConnectorName", activeDirectoryConnectorName); + 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.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + _url = _url.Replace("{activeDirectoryConnectorName}", System.Uri.EscapeDataString(activeDirectoryConnectorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs new file mode 100644 index 0000000000000..9568d41ff7676 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ActiveDirectoryConnectorsOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ActiveDirectoryConnectorsOperations. + /// + public static partial class ActiveDirectoryConnectorsOperationsExtensions + { + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + public static IPage List(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName) + { + return operations.ListAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + public static ActiveDirectoryConnectorResource Create(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties) + { + return operations.CreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + public static void Delete(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName) + { + operations.DeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + public static ActiveDirectoryConnectorResource Get(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName) + { + return operations.GetAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + public static ActiveDirectoryConnectorResource BeginCreate(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties) + { + return operations.BeginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + public static void BeginDelete(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName) + { + operations.BeginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IActiveDirectoryConnectorsOperations operations, string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IActiveDirectoryConnectorsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IActiveDirectoryConnectorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs new file mode 100644 index 0000000000000..755bd3101c1ae --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/AzureArcDataManagementClient.cs @@ -0,0 +1,389 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// The AzureArcData management API provides a RESTful set of web APIs to + /// manage Azure Data Services on Azure Arc Resources. + /// + public partial class AzureArcDataManagementClient : ServiceClient, IAzureArcDataManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The ID of the Azure subscription + /// + public string SubscriptionId { get; set; } + + /// + /// The API version to use for the request + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the ISqlManagedInstancesOperations. + /// + public virtual ISqlManagedInstancesOperations SqlManagedInstances { get; private set; } + + /// + /// Gets the ISqlServerInstancesOperations. + /// + public virtual ISqlServerInstancesOperations SqlServerInstances { get; private set; } + + /// + /// Gets the IDataControllersOperations. + /// + public virtual IDataControllersOperations DataControllers { get; private set; } + + /// + /// Gets the IActiveDirectoryConnectorsOperations. + /// + public virtual IActiveDirectoryConnectorsOperations ActiveDirectoryConnectors { get; private set; } + + /// + /// Gets the IPostgresInstancesOperations. + /// + public virtual IPostgresInstancesOperations PostgresInstances { get; private set; } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureArcDataManagementClient.Dispose(). False: will not dispose provided httpClient + protected AzureArcDataManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureArcDataManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureArcDataManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected AzureArcDataManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected AzureArcDataManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureArcDataManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the AzureArcDataManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public AzureArcDataManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + SqlManagedInstances = new SqlManagedInstancesOperations(this); + SqlServerInstances = new SqlServerInstancesOperations(this); + DataControllers = new DataControllersOperations(this); + ActiveDirectoryConnectors = new ActiveDirectoryConnectorsOperations(this); + PostgresInstances = new PostgresInstancesOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2022-03-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs new file mode 100644 index 0000000000000..15408f49b33e1 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperations.cs @@ -0,0 +1,1581 @@ +// +// 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.AzureArcData +{ + 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; + + /// + /// DataControllersOperations operations. + /// + internal partial class DataControllersOperations : IServiceOperations, IDataControllersOperations + { + /// + /// Initializes a new instance of the DataControllersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DataControllersOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List dataController resources in the subscription + /// + /// + /// 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>> ListInSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The name of the Azure resource group + /// + /// + /// 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>> ListInGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInGroup", 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.AzureArcData/dataControllers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPutDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerResource, dataControllerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// 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> GetDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDataController", 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.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (dataControllerResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerResource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("dataControllerResource", dataControllerResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PatchDataController", 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.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(dataControllerResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataControllerResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// 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> BeginPutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerResource"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerResource", dataControllerResource); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPutDataController", 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.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(dataControllerResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataControllerResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// 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 BeginDeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (dataControllerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataControllerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dataControllerName", dataControllerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteDataController", 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.AzureArcData/dataControllers/{dataControllerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dataControllerName}", System.Uri.EscapeDataString(dataControllerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List dataController resources in the subscription + /// + /// + /// 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>> ListInSubscriptionNextWithHttpMessagesAsync(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, "ListInSubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInGroupNextWithHttpMessagesAsync(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, "ListInGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs new file mode 100644 index 0000000000000..64f5c3faccf28 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/DataControllersOperationsExtensions.cs @@ -0,0 +1,407 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataControllersOperations. + /// + public static partial class DataControllersOperationsExtensions + { + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListInSubscription(this IDataControllersOperations operations) + { + return operations.ListInSubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionAsync(this IDataControllersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInSubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListInGroup(this IDataControllersOperations operations, string resourceGroupName) + { + return operations.ListInGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListInGroupAsync(this IDataControllersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + public static DataControllerResource PutDataController(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName) + { + return operations.PutDataControllerAsync(resourceGroupName, dataControllerResource, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task PutDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerResource, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + public static void DeleteDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName) + { + operations.DeleteDataControllerAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task DeleteDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + public static DataControllerResource GetDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName) + { + return operations.GetDataControllerAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task GetDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + public static DataControllerResource PatchDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource) + { + return operations.PatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).GetAwaiter().GetResult(); + } + + /// + /// Updates a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// The cancellation token. + /// + public static async Task PatchDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PatchDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, dataControllerResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + public static DataControllerResource BeginPutDataController(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName) + { + return operations.BeginPutDataControllerAsync(resourceGroupName, dataControllerResource, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task BeginPutDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPutDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerResource, dataControllerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + public static void BeginDeleteDataController(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName) + { + operations.BeginDeleteDataControllerAsync(resourceGroupName, dataControllerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a dataController resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteDataControllerAsync(this IDataControllersOperations operations, string resourceGroupName, string dataControllerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteDataControllerWithHttpMessagesAsync(resourceGroupName, dataControllerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListInSubscriptionNext(this IDataControllersOperations operations, string nextPageLink) + { + return operations.ListInSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInSubscriptionNextAsync(this IDataControllersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListInGroupNext(this IDataControllersOperations operations, string nextPageLink) + { + return operations.ListInGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List dataController resources in the resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInGroupNextAsync(this IDataControllersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs new file mode 100644 index 0000000000000..0bd8d5c133ede --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IActiveDirectoryConnectorsOperations.cs @@ -0,0 +1,216 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ActiveDirectoryConnectorsOperations operations. + /// + public partial interface IActiveDirectoryConnectorsOperations + { + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// 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 dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector 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> GetWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces an Active Directory connector resource. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// null + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, string activeDirectoryConnectorName, ActiveDirectoryConnectorProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Active Directory connector resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The name of the Active Directory connector instance + /// + /// + /// 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 dataControllerName, string activeDirectoryConnectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the active directory connectors associated with the given data + /// controller. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs new file mode 100644 index 0000000000000..8b90c4ecc52f2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IAzureArcDataManagementClient.cs @@ -0,0 +1,104 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// The AzureArcData management API provides a RESTful set of web APIs to + /// manage Azure Data Services on Azure Arc Resources. + /// + public partial interface IAzureArcDataManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The ID of the Azure subscription + /// + string SubscriptionId { get; set; } + + /// + /// The API version to use for the request + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the ISqlManagedInstancesOperations. + /// + ISqlManagedInstancesOperations SqlManagedInstances { get; } + + /// + /// Gets the ISqlServerInstancesOperations. + /// + ISqlServerInstancesOperations SqlServerInstances { get; } + + /// + /// Gets the IDataControllersOperations. + /// + IDataControllersOperations DataControllers { get; } + + /// + /// Gets the IActiveDirectoryConnectorsOperations. + /// + IActiveDirectoryConnectorsOperations ActiveDirectoryConnectors { get; } + + /// + /// Gets the IPostgresInstancesOperations. + /// + IPostgresInstancesOperations PostgresInstances { get; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs new file mode 100644 index 0000000000000..20957be49dd5b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IDataControllersOperations.cs @@ -0,0 +1,265 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataControllersOperations operations. + /// + public partial interface IDataControllersOperations + { + /// + /// List dataController resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dataController resources in the resource group + /// + /// + /// The name of the Azure resource group + /// + /// + /// 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>> ListInGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// 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> PutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// 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 DeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// 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> GetDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// The update data controller resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PatchDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, DataControllerUpdate dataControllerResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// desc + /// + /// + /// The name of the data controller + /// + /// + /// 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> BeginPutDataControllerWithHttpMessagesAsync(string resourceGroupName, DataControllerResource dataControllerResource, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a dataController resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// The name of the data controller + /// + /// + /// 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 BeginDeleteDataControllerWithHttpMessagesAsync(string resourceGroupName, string dataControllerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dataController resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List dataController resources in the resource group + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..5965cad855a94 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IOperations.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available Azure Data Services on Azure Arc API + /// operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available Azure Data Services on Azure Arc API + /// operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.cs new file mode 100644 index 0000000000000..53fd7aaac0694 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/IPostgresInstancesOperations.cs @@ -0,0 +1,271 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PostgresInstancesOperations operations. + /// + public partial interface IPostgresInstancesOperations + { + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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> GetWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres 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> CreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// 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 postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// 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 postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs new file mode 100644 index 0000000000000..1ca37ec445851 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlManagedInstancesOperations.cs @@ -0,0 +1,271 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlManagedInstancesOperations operations. + /// + public partial interface ISqlManagedInstancesOperations + { + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL 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> GetWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// Resource tags. + /// + /// + /// 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 sqlManagedInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs new file mode 100644 index 0000000000000..70c571588ee83 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/ISqlServerInstancesOperations.cs @@ -0,0 +1,271 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlServerInstancesOperations operations. + /// + public partial interface ISqlServerInstancesOperations + { + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server 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> GetWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// 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 sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Resource tags. + /// + /// + /// 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 sqlServerInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// 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 sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.cs new file mode 100644 index 0000000000000..97c6cf5fdaa9a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDNSDetails.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// DNS server details + /// + public partial class ActiveDirectoryConnectorDNSDetails + { + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDNSDetails class. + /// + public ActiveDirectoryConnectorDNSDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDNSDetails class. + /// + /// List of Active Directory DNS + /// server IP addresses. + /// DNS domain name for which DNS lookups + /// should be forwarded to the Active Directory DNS servers. + /// Replica count for DNS proxy service. Default + /// value is 1. + /// Flag indicating whether to + /// prefer Kubernetes DNS server response over AD DNS server response + /// for IP address lookups. + public ActiveDirectoryConnectorDNSDetails(IList nameserverIPAddresses, string domainName = default(string), long? replicas = default(long?), bool? preferK8sDnsForPtrLookups = default(bool?)) + { + DomainName = domainName; + NameserverIPAddresses = nameserverIPAddresses; + Replicas = replicas; + PreferK8sDnsForPtrLookups = preferK8sDnsForPtrLookups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets DNS domain name for which DNS lookups should be + /// forwarded to the Active Directory DNS servers. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Gets or sets list of Active Directory DNS server IP addresses. + /// + [JsonProperty(PropertyName = "nameserverIPAddresses")] + public IList NameserverIPAddresses { get; set; } + + /// + /// Gets or sets replica count for DNS proxy service. Default value is + /// 1. + /// + [JsonProperty(PropertyName = "replicas")] + public long? Replicas { get; set; } + + /// + /// Gets or sets flag indicating whether to prefer Kubernetes DNS + /// server response over AD DNS server response for IP address lookups. + /// + [JsonProperty(PropertyName = "preferK8sDnsForPtrLookups")] + public bool? PreferK8sDnsForPtrLookups { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.cs new file mode 100644 index 0000000000000..588414f2d2c12 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorDomainDetails.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Active Directory domain details + /// + public partial class ActiveDirectoryConnectorDomainDetails + { + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDomainDetails class. + /// + public ActiveDirectoryConnectorDomainDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorDomainDetails class. + /// + /// Name (uppercase) of the Active Directory domain + /// that this AD connector will be associated with. + /// null + /// NETBIOS name of the Active + /// Directory domain. + public ActiveDirectoryConnectorDomainDetails(string realm, ActiveDirectoryDomainControllers domainControllers, string netbiosDomainName = default(string)) + { + Realm = realm; + NetbiosDomainName = netbiosDomainName; + DomainControllers = domainControllers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name (uppercase) of the Active Directory domain that + /// this AD connector will be associated with. + /// + [JsonProperty(PropertyName = "realm")] + public string Realm { get; set; } + + /// + /// Gets or sets NETBIOS name of the Active Directory domain. + /// + [JsonProperty(PropertyName = "netbiosDomainName")] + public string NetbiosDomainName { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "domainControllers")] + public ActiveDirectoryDomainControllers DomainControllers { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.cs new file mode 100644 index 0000000000000..5c3f0b07d13ad --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorProperties.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of an Active Directory connector resource + /// + public partial class ActiveDirectoryConnectorProperties + { + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorProperties class. + /// + public ActiveDirectoryConnectorProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActiveDirectoryConnectorProperties class. + /// + /// null + /// The provisioning state of the + /// Active Directory connector resource. + /// null + public ActiveDirectoryConnectorProperties(ActiveDirectoryConnectorSpec spec, string provisioningState = default(string), ActiveDirectoryConnectorStatus status = default(ActiveDirectoryConnectorStatus)) + { + ProvisioningState = provisioningState; + Spec = spec; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioning state of the Active Directory connector + /// resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "spec")] + public ActiveDirectoryConnectorSpec Spec { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "status")] + public ActiveDirectoryConnectorStatus Status { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.cs new file mode 100644 index 0000000000000..5d002dcfa0755 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorResource.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Active directory connector resource + /// + public partial class ActiveDirectoryConnectorResource : ProxyResource + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorResource + /// class. + /// + public ActiveDirectoryConnectorResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryConnectorResource + /// class. + /// + /// null + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ActiveDirectoryConnectorResource(ActiveDirectoryConnectorProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "properties")] + public ActiveDirectoryConnectorProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.cs new file mode 100644 index 0000000000000..dbe53e5cf96f0 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorSpec.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The specifications of the AD Kubernetes resource. + /// + public partial class ActiveDirectoryConnectorSpec + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorSpec + /// class. + /// + public ActiveDirectoryConnectorSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryConnectorSpec + /// class. + /// + /// null + /// null + public ActiveDirectoryConnectorSpec(ActiveDirectoryConnectorDomainDetails activeDirectory, ActiveDirectoryConnectorDNSDetails dns) + { + ActiveDirectory = activeDirectory; + Dns = dns; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "activeDirectory")] + public ActiveDirectoryConnectorDomainDetails ActiveDirectory { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "dns")] + public ActiveDirectoryConnectorDNSDetails Dns { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs new file mode 100644 index 0000000000000..ec7f25ccd2891 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryConnectorStatus.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The status of the Kubernetes custom resource. + /// + public partial class ActiveDirectoryConnectorStatus + { + /// + /// Initializes a new instance of the ActiveDirectoryConnectorStatus + /// class. + /// + public ActiveDirectoryConnectorStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryConnectorStatus + /// class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// The time that the custom resource was + /// last updated. + /// The version of the replicaSet + /// associated with the AD connector custom resource. + /// The state of the AD connector custom + /// resource. + public ActiveDirectoryConnectorStatus(IDictionary additionalProperties = default(IDictionary), string lastUpdateTime = default(string), long? observedGeneration = default(long?), string state = default(string)) + { + AdditionalProperties = additionalProperties; + LastUpdateTime = lastUpdateTime; + ObservedGeneration = observedGeneration; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Gets or sets the time that the custom resource was last updated. + /// + [JsonProperty(PropertyName = "lastUpdateTime")] + public string LastUpdateTime { get; set; } + + /// + /// Gets or sets the version of the replicaSet associated with the AD + /// connector custom resource. + /// + [JsonProperty(PropertyName = "observedGeneration")] + public long? ObservedGeneration { get; set; } + + /// + /// Gets or sets the state of the AD connector custom resource. + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs new file mode 100644 index 0000000000000..f1714df6f6554 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainController.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a domain controller in the AD domain. + /// + public partial class ActiveDirectoryDomainController + { + /// + /// Initializes a new instance of the ActiveDirectoryDomainController + /// class. + /// + public ActiveDirectoryDomainController() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryDomainController + /// class. + /// + /// Fully-qualified domain name of a domain + /// controller in the AD domain. + public ActiveDirectoryDomainController(string hostname) + { + Hostname = hostname; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully-qualified domain name of a domain controller in + /// the AD domain. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs new file mode 100644 index 0000000000000..b696ed3452e84 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryDomainControllers.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details about the Active Directory domain controllers associated with + /// this AD connector instance + /// + public partial class ActiveDirectoryDomainControllers + { + /// + /// Initializes a new instance of the ActiveDirectoryDomainControllers + /// class. + /// + public ActiveDirectoryDomainControllers() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryDomainControllers + /// class. + /// + /// Information about the Primary + /// Domain Controller (PDC) in the AD domain. + /// null + public ActiveDirectoryDomainControllers(ActiveDirectoryDomainController primaryDomainController = default(ActiveDirectoryDomainController), IList secondaryDomainControllers = default(IList)) + { + PrimaryDomainController = primaryDomainController; + SecondaryDomainControllers = secondaryDomainControllers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets information about the Primary Domain Controller (PDC) + /// in the AD domain. + /// + [JsonProperty(PropertyName = "primaryDomainController")] + public ActiveDirectoryDomainController PrimaryDomainController { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "secondaryDomainControllers")] + public IList SecondaryDomainControllers { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.cs new file mode 100644 index 0000000000000..83872811700cd --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ActiveDirectoryInformation.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Active Directory information that related to the resource. + /// + public partial class ActiveDirectoryInformation + { + /// + /// Initializes a new instance of the ActiveDirectoryInformation class. + /// + public ActiveDirectoryInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveDirectoryInformation class. + /// + /// Keytab information that is used for + /// the Sql Managed Instance when Active Directory authentication is + /// used. + public ActiveDirectoryInformation(KeytabInformation keytabInformation = default(KeytabInformation)) + { + KeytabInformation = keytabInformation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets keytab information that is used for the Sql Managed + /// Instance when Active Directory authentication is used. + /// + [JsonProperty(PropertyName = "keytabInformation")] + public KeytabInformation KeytabInformation { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs new file mode 100644 index 0000000000000..b7fe4250ecfca --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlManagedInstanceLicenseType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for ArcSqlManagedInstanceLicenseType. + /// + public static class ArcSqlManagedInstanceLicenseType + { + public const string BasePrice = "BasePrice"; + public const string LicenseIncluded = "LicenseIncluded"; + public const string DisasterRecovery = "DisasterRecovery"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs new file mode 100644 index 0000000000000..a69437ba684da --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ArcSqlServerLicenseType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for ArcSqlServerLicenseType. + /// + public static class ArcSqlServerLicenseType + { + public const string Paid = "Paid"; + public const string Free = "Free"; + public const string HADR = "HADR"; + public const string Undefined = "Undefined"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 0000000000000..ced7f8e1f2706 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,64 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs new file mode 100644 index 0000000000000..b8369bc86e103 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/BasicLoginInformation.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Username and password for basic login authentication. + /// + public partial class BasicLoginInformation + { + /// + /// Initializes a new instance of the BasicLoginInformation class. + /// + public BasicLoginInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BasicLoginInformation class. + /// + /// Login username. + /// Login password. + public BasicLoginInformation(string username = default(string), string password = default(string)) + { + Username = username; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets login username. + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets login password. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs new file mode 100644 index 0000000000000..b151c196c8db8 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CommonSku.cs @@ -0,0 +1,96 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU for ARM resources + /// + public partial class CommonSku + { + /// + /// Initializes a new instance of the CommonSku class. + /// + public CommonSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommonSku class. + /// + /// The name of the SKU. It is typically a + /// letter+number code + /// Whether dev/test is enabled. When the dev field + /// is set to true, the resource is used for dev/test purpose. + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + public CommonSku(string name, bool? dev = default(bool?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Name = name; + Dev = dev; + Size = size; + Family = family; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the SKU. It is typically a letter+number + /// code + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets whether dev/test is enabled. When the dev field is set + /// to true, the resource is used for dev/test purpose. + /// + [JsonProperty(PropertyName = "dev")] + public bool? Dev { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Gets or sets if the service has different generations of hardware, + /// for the same SKU, then that can be captured here. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets if the SKU supports scale out/in then the capacity + /// integer should be included. If scale out/in is not possible for the + /// resource this may be omitted. + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs new file mode 100644 index 0000000000000..11dcb64c443cf --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ConnectionStatus.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for ConnectionStatus. + /// + public static class ConnectionStatus + { + public const string Connected = "Connected"; + public const string Disconnected = "Disconnected"; + public const string Registered = "Registered"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..439505316eddb --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs new file mode 100644 index 0000000000000..165519e87eac2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerProperties.cs @@ -0,0 +1,165 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The data controller properties. + /// + public partial class DataControllerProperties + { + /// + /// Initializes a new instance of the DataControllerProperties class. + /// + public DataControllerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataControllerProperties class. + /// + /// The infrastructure the data controller + /// is running on. Possible values include: 'azure', 'gcp', 'aws', + /// 'alibaba', 'onpremises', 'other' + /// The raw kubernetes information + /// Last uploaded date from Kubernetes + /// cluster. Defaults to current date time + /// Deprecated. Azure Arc Data + /// Services data controller no longer expose any endpoint. All traffic + /// are exposed through Kubernetes native API. + /// Login credential for + /// metrics dashboard on the Kubernetes cluster. + /// Login credential for logs + /// dashboard on the Kubernetes cluster. + /// Deprecated. Service principal + /// is deprecated in favor of Arc Kubernetes service extension managed + /// identity. + /// The provisioning state of the Arc + /// Data Controller resource. + /// If a CustomLocation is provided, this + /// contains the ARM id of the connected cluster the custom location + /// belongs to. + /// If a CustomLocation is provided, this + /// contains the ARM id of the extension the custom location belongs + /// to. + public DataControllerProperties(Infrastructure? infrastructure = default(Infrastructure?), OnPremiseProperty onPremiseProperty = default(OnPremiseProperty), object k8sRaw = default(object), UploadWatermark uploadWatermark = default(UploadWatermark), System.DateTime? lastUploadedDate = default(System.DateTime?), BasicLoginInformation basicLoginInformation = default(BasicLoginInformation), BasicLoginInformation metricsDashboardCredential = default(BasicLoginInformation), BasicLoginInformation logsDashboardCredential = default(BasicLoginInformation), LogAnalyticsWorkspaceConfig logAnalyticsWorkspaceConfig = default(LogAnalyticsWorkspaceConfig), UploadServicePrincipal uploadServicePrincipal = default(UploadServicePrincipal), string provisioningState = default(string), string clusterId = default(string), string extensionId = default(string)) + { + Infrastructure = infrastructure; + OnPremiseProperty = onPremiseProperty; + K8sRaw = k8sRaw; + UploadWatermark = uploadWatermark; + LastUploadedDate = lastUploadedDate; + BasicLoginInformation = basicLoginInformation; + MetricsDashboardCredential = metricsDashboardCredential; + LogsDashboardCredential = logsDashboardCredential; + LogAnalyticsWorkspaceConfig = logAnalyticsWorkspaceConfig; + UploadServicePrincipal = uploadServicePrincipal; + ProvisioningState = provisioningState; + ClusterId = clusterId; + ExtensionId = extensionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the infrastructure the data controller is running on. + /// Possible values include: 'azure', 'gcp', 'aws', 'alibaba', + /// 'onpremises', 'other' + /// + [JsonProperty(PropertyName = "infrastructure")] + public Infrastructure? Infrastructure { get; set; } + + /// + /// + [JsonProperty(PropertyName = "onPremiseProperty")] + public OnPremiseProperty OnPremiseProperty { get; set; } + + /// + /// Gets or sets the raw kubernetes information + /// + [JsonProperty(PropertyName = "k8sRaw")] + public object K8sRaw { get; set; } + + /// + /// + [JsonProperty(PropertyName = "uploadWatermark")] + public UploadWatermark UploadWatermark { get; set; } + + /// + /// Gets or sets last uploaded date from Kubernetes cluster. Defaults + /// to current date time + /// + [JsonProperty(PropertyName = "lastUploadedDate")] + public System.DateTime? LastUploadedDate { get; set; } + + /// + /// Gets or sets deprecated. Azure Arc Data Services data controller no + /// longer expose any endpoint. All traffic are exposed through + /// Kubernetes native API. + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// Gets or sets login credential for metrics dashboard on the + /// Kubernetes cluster. + /// + [JsonProperty(PropertyName = "metricsDashboardCredential")] + public BasicLoginInformation MetricsDashboardCredential { get; set; } + + /// + /// Gets or sets login credential for logs dashboard on the Kubernetes + /// cluster. + /// + [JsonProperty(PropertyName = "logsDashboardCredential")] + public BasicLoginInformation LogsDashboardCredential { get; set; } + + /// + /// + [JsonProperty(PropertyName = "logAnalyticsWorkspaceConfig")] + public LogAnalyticsWorkspaceConfig LogAnalyticsWorkspaceConfig { get; set; } + + /// + /// Gets or sets deprecated. Service principal is deprecated in favor + /// of Arc Kubernetes service extension managed identity. + /// + [JsonProperty(PropertyName = "uploadServicePrincipal")] + public UploadServicePrincipal UploadServicePrincipal { get; set; } + + /// + /// Gets the provisioning state of the Arc Data Controller resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the connected cluster the custom location belongs to. + /// + [JsonProperty(PropertyName = "clusterId")] + public string ClusterId { get; set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the extension the custom location belongs to. + /// + [JsonProperty(PropertyName = "extensionId")] + public string ExtensionId { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs new file mode 100644 index 0000000000000..3211f7a7cdb0e --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerResource.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Data controller resource + /// + public partial class DataControllerResource : TrackedResource + { + /// + /// Initializes a new instance of the DataControllerResource class. + /// + public DataControllerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataControllerResource class. + /// + /// The geo-location where the resource + /// lives + /// The data controller's properties + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// The extendedLocation of the + /// resource. + public DataControllerResource(string location, DataControllerProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation)) + : base(location, id, name, type, systemData, tags) + { + ExtendedLocation = extendedLocation; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the extendedLocation of the resource. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets or sets the data controller's properties + /// + [JsonProperty(PropertyName = "properties")] + public DataControllerProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs new file mode 100644 index 0000000000000..bbae6e1d4c464 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DataControllerUpdate.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Used for updating a data controller resource. + /// + public partial class DataControllerUpdate + { + /// + /// Initializes a new instance of the DataControllerUpdate class. + /// + public DataControllerUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataControllerUpdate class. + /// + /// Resource tags + /// The data controller's properties + public DataControllerUpdate(IDictionary tags = default(IDictionary), DataControllerProperties properties = default(DataControllerProperties)) + { + Tags = tags; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the data controller's properties + /// + [JsonProperty(PropertyName = "properties")] + public DataControllerProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs new file mode 100644 index 0000000000000..caad97050980d --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/DefenderStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for DefenderStatus. + /// + public static class DefenderStatus + { + public const string Protected = "Protected"; + public const string Unprotected = "Unprotected"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs new file mode 100644 index 0000000000000..eea7f782bf360 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/EditionType.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for EditionType. + /// + public static class EditionType + { + public const string Evaluation = "Evaluation"; + public const string Enterprise = "Enterprise"; + public const string Standard = "Standard"; + public const string Web = "Web"; + public const string Developer = "Developer"; + public const string Express = "Express"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..a7dc6e20f72d2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An error response from the Azure Data on Azure Arc service. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// null + public ErrorResponse(ErrorResponseBody error = default(ErrorResponseBody)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "error")] + public ErrorResponseBody Error { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs new file mode 100644 index 0000000000000..c8ccab35c370b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseBody.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An error response from the Batch service. + /// + public partial class ErrorResponseBody + { + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + public ErrorResponseBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + /// An identifier for the error. Codes are invariant + /// and are intended to be consumed programmatically. + /// A message describing the error, intended to + /// be suitable for display in a user interface. + /// The target of the particular error. For + /// example, the name of the property in error. + /// A list of additional details about the + /// error. + public ErrorResponseBody(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an identifier for the error. Codes are invariant and + /// are intended to be consumed programmatically. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets a message describing the error, intended to be + /// suitable for display in a user interface. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the target of the particular error. For example, the + /// name of the property in error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets a list of additional details about the error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..d3c8a4b94e719 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs new file mode 100644 index 0000000000000..a85bda3f8db68 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The complex type of the extended location. + /// + public partial class ExtendedLocation + { + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + public ExtendedLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExtendedLocation class. + /// + /// The name of the extended location. + /// The type of the extended location. Possible + /// values include: 'CustomLocation' + public ExtendedLocation(string name = default(string), string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extended location. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the type of the extended location. Possible values + /// include: 'CustomLocation' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs new file mode 100644 index 0000000000000..6dad751b48c60 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ExtendedLocationTypes.cs @@ -0,0 +1,21 @@ +// +// 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.AzureArcData.Models +{ + + /// + /// Defines values for ExtendedLocationTypes. + /// + public static class ExtendedLocationTypes + { + public const string CustomLocation = "CustomLocation"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs new file mode 100644 index 0000000000000..64a8370026cb2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/HostType.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for HostType. + /// + public static class HostType + { + public const string VirtualMachine = "Virtual Machine"; + public const string PhysicalServer = "Physical Server"; + public const string AWSVirtualMachine = "AWS Virtual Machine"; + public const string GCPVirtualMachine = "GCP Virtual Machine"; + public const string Other = "Other"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs new file mode 100644 index 0000000000000..1d806b0447e12 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Infrastructure.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for Infrastructure. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Infrastructure + { + [EnumMember(Value = "azure")] + Azure, + [EnumMember(Value = "gcp")] + Gcp, + [EnumMember(Value = "aws")] + Aws, + [EnumMember(Value = "alibaba")] + Alibaba, + [EnumMember(Value = "onpremises")] + Onpremises, + [EnumMember(Value = "other")] + Other + } + internal static class InfrastructureEnumExtension + { + internal static string ToSerializedValue(this Infrastructure? value) + { + return value == null ? null : ((Infrastructure)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this Infrastructure value) + { + switch( value ) + { + case Infrastructure.Azure: + return "azure"; + case Infrastructure.Gcp: + return "gcp"; + case Infrastructure.Aws: + return "aws"; + case Infrastructure.Alibaba: + return "alibaba"; + case Infrastructure.Onpremises: + return "onpremises"; + case Infrastructure.Other: + return "other"; + } + return null; + } + + internal static Infrastructure? ParseInfrastructure(this string value) + { + switch( value ) + { + case "azure": + return Infrastructure.Azure; + case "gcp": + return Infrastructure.Gcp; + case "aws": + return Infrastructure.Aws; + case "alibaba": + return Infrastructure.Alibaba; + case "onpremises": + return Infrastructure.Onpremises; + case "other": + return Infrastructure.Other; + } + return null; + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs new file mode 100644 index 0000000000000..95c23fb027b1a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sResourceRequirements.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes resource limits and requests used to restrict or reserve + /// resource usage. + /// + public partial class K8sResourceRequirements + { + /// + /// Initializes a new instance of the K8sResourceRequirements class. + /// + public K8sResourceRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sResourceRequirements class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Requests for a kubernetes resource type (e.g + /// 'cpu', 'memory'). The 'cpu' request must be less than or equal to + /// 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is + /// '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum + /// 'cpu' is 24 and maximum 'memory' is '128Gi'. + /// Limits for a kubernetes resource type (e.g + /// 'cpu', 'memory'). The 'cpu' request must be less than or equal to + /// 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is + /// '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum + /// 'cpu' is 24 and maximum 'memory' is '128Gi'. + public K8sResourceRequirements(IDictionary additionalProperties = default(IDictionary), IDictionary requests = default(IDictionary), IDictionary limits = default(IDictionary)) + { + AdditionalProperties = additionalProperties; + Requests = requests; + Limits = limits; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Gets or sets requests for a kubernetes resource type (e.g 'cpu', + /// 'memory'). The 'cpu' request must be less than or equal to 'cpu' + /// limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', + /// minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 + /// and maximum 'memory' is '128Gi'. + /// + [JsonProperty(PropertyName = "requests")] + public IDictionary Requests { get; set; } + + /// + /// Gets or sets limits for a kubernetes resource type (e.g 'cpu', + /// 'memory'). The 'cpu' request must be less than or equal to 'cpu' + /// limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', + /// minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 + /// and maximum 'memory' is '128Gi'. + /// + [JsonProperty(PropertyName = "limits")] + public IDictionary Limits { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs new file mode 100644 index 0000000000000..db19e7aa84ccd --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sScheduling.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes scheduling information. + /// + public partial class K8sScheduling + { + /// + /// Initializes a new instance of the K8sScheduling class. + /// + public K8sScheduling() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sScheduling class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public K8sScheduling(IDictionary additionalProperties = default(IDictionary), K8sSchedulingOptions defaultProperty = default(K8sSchedulingOptions)) + { + AdditionalProperties = additionalProperties; + DefaultProperty = defaultProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "default")] + public K8sSchedulingOptions DefaultProperty { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs new file mode 100644 index 0000000000000..80930269bb8e1 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/K8sSchedulingOptions.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes scheduling options. It describes restrictions used to + /// help Kubernetes select appropriate nodes to host the database service + /// + public partial class K8sSchedulingOptions + { + /// + /// Initializes a new instance of the K8sSchedulingOptions class. + /// + public K8sSchedulingOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sSchedulingOptions class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public K8sSchedulingOptions(IDictionary additionalProperties = default(IDictionary), K8sResourceRequirements resources = default(K8sResourceRequirements)) + { + AdditionalProperties = additionalProperties; + Resources = resources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "resources")] + public K8sResourceRequirements Resources { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.cs new file mode 100644 index 0000000000000..adac4417513d6 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/KeytabInformation.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Keytab used for authenticate with Active Directory. + /// + public partial class KeytabInformation + { + /// + /// Initializes a new instance of the KeytabInformation class. + /// + public KeytabInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeytabInformation class. + /// + /// A base64-encoded keytab. + public KeytabInformation(string keytab = default(string)) + { + Keytab = keytab; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a base64-encoded keytab. + /// + [JsonProperty(PropertyName = "keytab")] + public string Keytab { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs new file mode 100644 index 0000000000000..1ec7ae9997d8a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/LogAnalyticsWorkspaceConfig.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Log analytics workspace id and primary key + /// + public partial class LogAnalyticsWorkspaceConfig + { + /// + /// Initializes a new instance of the LogAnalyticsWorkspaceConfig + /// class. + /// + public LogAnalyticsWorkspaceConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsWorkspaceConfig + /// class. + /// + /// Azure Log Analytics workspace ID + /// Primary key of the workspace + public LogAnalyticsWorkspaceConfig(System.Guid? workspaceId = default(System.Guid?), string primaryKey = default(string)) + { + WorkspaceId = workspaceId; + PrimaryKey = primaryKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Log Analytics workspace ID + /// + [JsonProperty(PropertyName = "workspaceId")] + public System.Guid? WorkspaceId { get; set; } + + /// + /// Gets or sets primary key of the workspace + /// + [JsonProperty(PropertyName = "primaryKey")] + public string PrimaryKey { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs new file mode 100644 index 0000000000000..f9b283b459923 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OnPremiseProperty.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties from the Kubernetes data controller + /// + public partial class OnPremiseProperty + { + /// + /// Initializes a new instance of the OnPremiseProperty class. + /// + public OnPremiseProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnPremiseProperty class. + /// + /// A globally unique ID identifying the associated + /// Kubernetes cluster + /// Certificate that contains the + /// Kubernetes cluster public key used to verify signing + /// Unique thumbprint + /// returned to customer to verify the certificate being + /// uploaded + public OnPremiseProperty(System.Guid id, string publicSigningKey, string signingCertificateThumbprint = default(string)) + { + Id = id; + PublicSigningKey = publicSigningKey; + SigningCertificateThumbprint = signingCertificateThumbprint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a globally unique ID identifying the associated + /// Kubernetes cluster + /// + [JsonProperty(PropertyName = "id")] + public System.Guid Id { get; set; } + + /// + /// Gets or sets certificate that contains the Kubernetes cluster + /// public key used to verify signing + /// + [JsonProperty(PropertyName = "publicSigningKey")] + public string PublicSigningKey { get; set; } + + /// + /// Gets or sets unique thumbprint returned to customer to verify the + /// certificate being uploaded + /// + [JsonProperty(PropertyName = "signingCertificateThumbprint")] + public string SigningCertificateThumbprint { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs new file mode 100644 index 0000000000000..65a82ecc0f022 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Operation.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Azure Data Services on Azure Arc operation definition. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// The name of the operation being performed on + /// this particular object. + /// The localized display information for this + /// particular operation / action. + /// Indicates whether the operation is a + /// data action + /// The intended executor of the operation. + /// Possible values include: 'user', 'system' + /// Additional descriptions for the + /// operation. + public Operation(string name, OperationDisplay display, bool isDataAction, string origin = default(string), IDictionary properties = default(IDictionary)) + { + Name = name; + Display = display; + Origin = origin; + IsDataAction = isDataAction; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the operation being performed on this + /// particular object. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the localized display information for this particular + /// operation / action. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets the intended executor of the operation. Possible values + /// include: 'user', 'system' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool IsDataAction { get; set; } + + /// + /// Gets additional descriptions for the operation. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..9fc055c7362ce --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Display metadata associated with the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// The localized friendly form of the resource + /// provider name. + /// The localized friendly form of the resource + /// type related to this action/operation. + /// The localized friendly name for the + /// operation. + /// The localized friendly description for + /// the operation. + public OperationDisplay(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the localized friendly form of the resource provider + /// name. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets the localized friendly form of the resource type + /// related to this action/operation. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets the localized friendly name for the operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets the localized friendly description for the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs new file mode 100644 index 0000000000000..80b0feed04767 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/OperationOrigin.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + + /// + /// Defines values for OperationOrigin. + /// + public static class OperationOrigin + { + public const string User = "user"; + public const string System = "system"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..27c055e3441fb --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs new file mode 100644 index 0000000000000..61e42d6abf721 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstance.cs @@ -0,0 +1,82 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Postgres Instance. + /// + public partial class PostgresInstance : TrackedResource + { + /// + /// Initializes a new instance of the PostgresInstance class. + /// + public PostgresInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstance class. + /// + /// The geo-location where the resource + /// lives + /// null + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// The extendedLocation of the + /// resource. + /// Resource sku. + public PostgresInstance(string location, PostgresInstanceProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), PostgresInstanceSku sku = default(PostgresInstanceSku)) + : base(location, id, name, type, systemData, tags) + { + ExtendedLocation = extendedLocation; + Properties = properties; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the extendedLocation of the resource. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "properties")] + public PostgresInstanceProperties Properties { get; set; } + + /// + /// Gets or sets resource sku. + /// + [JsonProperty(PropertyName = "sku")] + public PostgresInstanceSku Sku { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.cs new file mode 100644 index 0000000000000..2c04755837b8b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceProperties.cs @@ -0,0 +1,96 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Postgres Instance properties. + /// + public partial class PostgresInstanceProperties + { + /// + /// Initializes a new instance of the PostgresInstanceProperties class. + /// + public PostgresInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstanceProperties class. + /// + /// The data controller id + /// The instance admin + /// Username and password for basic + /// authentication. + /// The raw kubernetes information + /// Last uploaded date from Kubernetes + /// cluster. Defaults to current date time + /// The provisioning state of the Azure + /// Arc-enabled PostgreSQL instance. + public PostgresInstanceProperties(string dataControllerId = default(string), string admin = default(string), BasicLoginInformation basicLoginInformation = default(BasicLoginInformation), object k8sRaw = default(object), System.DateTime? lastUploadedDate = default(System.DateTime?), string provisioningState = default(string)) + { + DataControllerId = dataControllerId; + Admin = admin; + BasicLoginInformation = basicLoginInformation; + K8sRaw = k8sRaw; + LastUploadedDate = lastUploadedDate; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the data controller id + /// + [JsonProperty(PropertyName = "dataControllerId")] + public string DataControllerId { get; set; } + + /// + /// Gets or sets the instance admin + /// + [JsonProperty(PropertyName = "admin")] + public string Admin { get; set; } + + /// + /// Gets or sets username and password for basic authentication. + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// Gets or sets the raw kubernetes information + /// + [JsonProperty(PropertyName = "k8sRaw")] + public object K8sRaw { get; set; } + + /// + /// Gets or sets last uploaded date from Kubernetes cluster. Defaults + /// to current date time + /// + [JsonProperty(PropertyName = "lastUploadedDate")] + public System.DateTime? LastUploadedDate { get; set; } + + /// + /// Gets the provisioning state of the Azure Arc-enabled PostgreSQL + /// instance. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs new file mode 100644 index 0000000000000..ffcfe0d197a0f --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSku.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU for Azure Database for + /// PostgresSQL - Azure Arc + /// + public partial class PostgresInstanceSku : CommonSku + { + /// + /// Initializes a new instance of the PostgresInstanceSku class. + /// + public PostgresInstanceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstanceSku class. + /// + /// The name of the SKU. It is typically a + /// letter+number code + /// Whether dev/test is enabled. When the dev field + /// is set to true, the resource is used for dev/test purpose. + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + /// This field is required to be implemented by the + /// Resource Provider if the service has more than one tier. Possible + /// values include: 'Hyperscale' + public PostgresInstanceSku(string name, bool? dev = default(bool?), string size = default(string), string family = default(string), int? capacity = default(int?), PostgresInstanceSkuTier? tier = default(PostgresInstanceSkuTier?)) + : base(name, dev, size, family, capacity) + { + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this field is required to be implemented by the + /// Resource Provider if the service has more than one tier. Possible + /// values include: 'Hyperscale' + /// + [JsonProperty(PropertyName = "tier")] + public PostgresInstanceSkuTier? Tier { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.cs new file mode 100644 index 0000000000000..1c84d8c6758e9 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceSkuTier.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for PostgresInstanceSkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PostgresInstanceSkuTier + { + [EnumMember(Value = "Hyperscale")] + Hyperscale + } + internal static class PostgresInstanceSkuTierEnumExtension + { + internal static string ToSerializedValue(this PostgresInstanceSkuTier? value) + { + return value == null ? null : ((PostgresInstanceSkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this PostgresInstanceSkuTier value) + { + switch( value ) + { + case PostgresInstanceSkuTier.Hyperscale: + return "Hyperscale"; + } + return null; + } + + internal static PostgresInstanceSkuTier? ParsePostgresInstanceSkuTier(this string value) + { + switch( value ) + { + case "Hyperscale": + return PostgresInstanceSkuTier.Hyperscale; + } + return null; + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.cs new file mode 100644 index 0000000000000..e5eea763d4a50 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/PostgresInstanceUpdate.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a Postgres Instance. + /// + public partial class PostgresInstanceUpdate + { + /// + /// Initializes a new instance of the PostgresInstanceUpdate class. + /// + public PostgresInstanceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PostgresInstanceUpdate class. + /// + /// Resource tags. + public PostgresInstanceUpdate(IDictionary tags = default(IDictionary), PostgresInstanceProperties properties = default(PostgresInstanceProperties)) + { + Tags = tags; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public PostgresInstanceProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..12c8463f34ce2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..8ca97e954c38a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/Resource.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource + /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs new file mode 100644 index 0000000000000..cebfbb80f8a92 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstance.cs @@ -0,0 +1,82 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A SqlManagedInstance. + /// + public partial class SqlManagedInstance : TrackedResource + { + /// + /// Initializes a new instance of the SqlManagedInstance class. + /// + public SqlManagedInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstance class. + /// + /// The geo-location where the resource + /// lives + /// null + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// The extendedLocation of the + /// resource. + /// Resource sku. + public SqlManagedInstance(string location, SqlManagedInstanceProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ExtendedLocation extendedLocation = default(ExtendedLocation), SqlManagedInstanceSku sku = default(SqlManagedInstanceSku)) + : base(location, id, name, type, systemData, tags) + { + Properties = properties; + ExtendedLocation = extendedLocation; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "properties")] + public SqlManagedInstanceProperties Properties { get; set; } + + /// + /// Gets or sets the extendedLocation of the resource. + /// + [JsonProperty(PropertyName = "extendedLocation")] + public ExtendedLocation ExtendedLocation { get; set; } + + /// + /// Gets or sets resource sku. + /// + [JsonProperty(PropertyName = "sku")] + public SqlManagedInstanceSku Sku { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs new file mode 100644 index 0000000000000..9bdcc2beecb81 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sRaw.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The raw kubernetes information. + /// + public partial class SqlManagedInstanceK8sRaw + { + /// + /// Initializes a new instance of the SqlManagedInstanceK8sRaw class. + /// + public SqlManagedInstanceK8sRaw() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceK8sRaw class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + public SqlManagedInstanceK8sRaw(IDictionary additionalProperties = default(IDictionary), SqlManagedInstanceK8sSpec spec = default(SqlManagedInstanceK8sSpec)) + { + AdditionalProperties = additionalProperties; + Spec = spec; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "spec")] + public SqlManagedInstanceK8sSpec Spec { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs new file mode 100644 index 0000000000000..b7103ec9260c2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceK8sSpec.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The kubernetes spec information. + /// + public partial class SqlManagedInstanceK8sSpec + { + /// + /// Initializes a new instance of the SqlManagedInstanceK8sSpec class. + /// + public SqlManagedInstanceK8sSpec() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceK8sSpec class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// This option specifies the number of SQL + /// Managed Instance replicas that will be deployed in your Kubernetes + /// cluster for high availability purposes. If sku.tier is + /// BusinessCritical, allowed values are '2' or '3' with default of + /// '3'. If sku.tier is GeneralPurpose, replicas must be '1'. + public SqlManagedInstanceK8sSpec(IDictionary additionalProperties = default(IDictionary), K8sScheduling scheduling = default(K8sScheduling), int? replicas = default(int?)) + { + AdditionalProperties = additionalProperties; + Scheduling = scheduling; + Replicas = replicas; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unmatched properties from the message are deserialized + /// this collection + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "scheduling")] + public K8sScheduling Scheduling { get; set; } + + /// + /// Gets or sets this option specifies the number of SQL Managed + /// Instance replicas that will be deployed in your Kubernetes cluster + /// for high availability purposes. If sku.tier is BusinessCritical, + /// allowed values are '2' or '3' with default of '3'. If sku.tier is + /// GeneralPurpose, replicas must be '1'. + /// + [JsonProperty(PropertyName = "replicas")] + public int? Replicas { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs new file mode 100644 index 0000000000000..c27b4dbbbc88f --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceProperties.cs @@ -0,0 +1,158 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of sqlManagedInstance. + /// + public partial class SqlManagedInstanceProperties + { + /// + /// Initializes a new instance of the SqlManagedInstanceProperties + /// class. + /// + public SqlManagedInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceProperties + /// class. + /// + /// null + /// The instance admin user + /// The instance start time + /// The instance end time + /// The raw kubernetes information + /// Username and password for basic + /// authentication. + /// Last uploaded date from Kubernetes + /// cluster. Defaults to current date time + /// The provisioning state of the + /// Arc-enabled SQL Managed Instance resource. + /// Active Directory + /// information related to this SQL Managed Instance. + /// The license type to apply for this + /// managed instance. Possible values include: 'BasePrice', + /// 'LicenseIncluded', 'DisasterRecovery' + /// If a CustomLocation is provided, this + /// contains the ARM id of the connected cluster the custom location + /// belongs to. + /// If a CustomLocation is provided, this + /// contains the ARM id of the extension the custom location belongs + /// to. + public SqlManagedInstanceProperties(string dataControllerId = default(string), string admin = default(string), string startTime = default(string), string endTime = default(string), SqlManagedInstanceK8sRaw k8sRaw = default(SqlManagedInstanceK8sRaw), BasicLoginInformation basicLoginInformation = default(BasicLoginInformation), System.DateTime? lastUploadedDate = default(System.DateTime?), string provisioningState = default(string), ActiveDirectoryInformation activeDirectoryInformation = default(ActiveDirectoryInformation), string licenseType = default(string), string clusterId = default(string), string extensionId = default(string)) + { + DataControllerId = dataControllerId; + Admin = admin; + StartTime = startTime; + EndTime = endTime; + K8sRaw = k8sRaw; + BasicLoginInformation = basicLoginInformation; + LastUploadedDate = lastUploadedDate; + ProvisioningState = provisioningState; + ActiveDirectoryInformation = activeDirectoryInformation; + LicenseType = licenseType; + ClusterId = clusterId; + ExtensionId = extensionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "dataControllerId")] + public string DataControllerId { get; set; } + + /// + /// Gets or sets the instance admin user + /// + [JsonProperty(PropertyName = "admin")] + public string Admin { get; set; } + + /// + /// Gets or sets the instance start time + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets the instance end time + /// + [JsonProperty(PropertyName = "endTime")] + public string EndTime { get; set; } + + /// + /// Gets or sets the raw kubernetes information + /// + [JsonProperty(PropertyName = "k8sRaw")] + public SqlManagedInstanceK8sRaw K8sRaw { get; set; } + + /// + /// Gets or sets username and password for basic authentication. + /// + [JsonProperty(PropertyName = "basicLoginInformation")] + public BasicLoginInformation BasicLoginInformation { get; set; } + + /// + /// Gets or sets last uploaded date from Kubernetes cluster. Defaults + /// to current date time + /// + [JsonProperty(PropertyName = "lastUploadedDate")] + public System.DateTime? LastUploadedDate { get; set; } + + /// + /// Gets the provisioning state of the Arc-enabled SQL Managed Instance + /// resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets active Directory information related to this SQL + /// Managed Instance. + /// + [JsonProperty(PropertyName = "activeDirectoryInformation")] + public ActiveDirectoryInformation ActiveDirectoryInformation { get; set; } + + /// + /// Gets or sets the license type to apply for this managed instance. + /// Possible values include: 'BasePrice', 'LicenseIncluded', + /// 'DisasterRecovery' + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the connected cluster the custom location belongs to. + /// + [JsonProperty(PropertyName = "clusterId")] + public string ClusterId { get; set; } + + /// + /// Gets or sets if a CustomLocation is provided, this contains the ARM + /// id of the extension the custom location belongs to. + /// + [JsonProperty(PropertyName = "extensionId")] + public string ExtensionId { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs new file mode 100644 index 0000000000000..2354de6a44fbb --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSku.cs @@ -0,0 +1,104 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU for Azure Managed + /// Instance - Azure Arc + /// + public partial class SqlManagedInstanceSku + { + /// + /// Initializes a new instance of the SqlManagedInstanceSku class. + /// + public SqlManagedInstanceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceSku class. + /// + /// The pricing tier for the instance. Possible + /// values include: 'GeneralPurpose', 'BusinessCritical' + /// Whether dev/test is enabled. When the dev field + /// is set to true, the resource is used for dev/test purpose. + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// The SKU family + /// The SKU capacity + public SqlManagedInstanceSku(SqlManagedInstanceSkuTier? tier = default(SqlManagedInstanceSkuTier?), bool? dev = default(bool?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Tier = tier; + Dev = dev; + Size = size; + Family = family; + Capacity = capacity; + CustomInit(); + } + /// + /// Static constructor for SqlManagedInstanceSku class. + /// + static SqlManagedInstanceSku() + { + Name = "vCore"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the pricing tier for the instance. Possible values + /// include: 'GeneralPurpose', 'BusinessCritical' + /// + [JsonProperty(PropertyName = "tier")] + public SqlManagedInstanceSkuTier? Tier { get; set; } + + /// + /// Gets or sets whether dev/test is enabled. When the dev field is set + /// to true, the resource is used for dev/test purpose. + /// + [JsonProperty(PropertyName = "dev")] + public bool? Dev { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Gets or sets the SKU family + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets the SKU capacity + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// The name of the SKU. + /// + [JsonProperty(PropertyName = "name")] + public static string Name { get; private set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs new file mode 100644 index 0000000000000..1a840475e662a --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceSkuTier.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SqlManagedInstanceSkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SqlManagedInstanceSkuTier + { + [EnumMember(Value = "GeneralPurpose")] + GeneralPurpose, + [EnumMember(Value = "BusinessCritical")] + BusinessCritical + } + internal static class SqlManagedInstanceSkuTierEnumExtension + { + internal static string ToSerializedValue(this SqlManagedInstanceSkuTier? value) + { + return value == null ? null : ((SqlManagedInstanceSkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SqlManagedInstanceSkuTier value) + { + switch( value ) + { + case SqlManagedInstanceSkuTier.GeneralPurpose: + return "GeneralPurpose"; + case SqlManagedInstanceSkuTier.BusinessCritical: + return "BusinessCritical"; + } + return null; + } + + internal static SqlManagedInstanceSkuTier? ParseSqlManagedInstanceSkuTier(this string value) + { + switch( value ) + { + case "GeneralPurpose": + return SqlManagedInstanceSkuTier.GeneralPurpose; + case "BusinessCritical": + return SqlManagedInstanceSkuTier.BusinessCritical; + } + return null; + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs new file mode 100644 index 0000000000000..381adf9bf5abc --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlManagedInstanceUpdate.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a SQL Managed Instance. + /// + public partial class SqlManagedInstanceUpdate + { + /// + /// Initializes a new instance of the SqlManagedInstanceUpdate class. + /// + public SqlManagedInstanceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlManagedInstanceUpdate class. + /// + /// Resource tags. + public SqlManagedInstanceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs new file mode 100644 index 0000000000000..45fe89978c576 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstance.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A SqlServerInstance. + /// + public partial class SqlServerInstance : TrackedResource + { + /// + /// Initializes a new instance of the SqlServerInstance class. + /// + public SqlServerInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerInstance class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// null + public SqlServerInstance(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), SqlServerInstanceProperties properties = default(SqlServerInstanceProperties)) + : base(location, id, name, type, systemData, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets null + /// + [JsonProperty(PropertyName = "properties")] + public SqlServerInstanceProperties Properties { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs new file mode 100644 index 0000000000000..c963b3a4b765c --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceProperties.cs @@ -0,0 +1,228 @@ +// +// 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.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of SqlServerInstance. + /// + public partial class SqlServerInstanceProperties + { + /// + /// Initializes a new instance of the SqlServerInstanceProperties + /// class. + /// + public SqlServerInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerInstanceProperties + /// class. + /// + /// ARM Resource id of the container + /// resource (Azure Arc for Servers). + /// The cloud connectivity status. Possible values + /// include: 'Connected', 'Disconnected', 'Registered', + /// 'Unknown' + /// SQL Server version. Possible values include: + /// 'SQL Server 2012', 'SQL Server 2014', 'SQL Server 2016', 'SQL + /// Server 2017', 'SQL Server 2019', 'SQL Server 2022', + /// 'Unknown' + /// SQL Server edition. Possible values include: + /// 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', + /// 'Express' + /// The time when the resource was + /// created. + /// The number of logical processors used by the + /// SQL Server instance. + /// SQL Server update level. + /// SQL Server collation. + /// SQL Server current version. + /// SQL Server instance name. + /// Dynamic TCP ports used by SQL + /// Server. + /// Static TCP ports used by SQL + /// Server. + /// SQL Server product ID. + /// SQL Server license type. Possible values + /// include: 'Paid', 'Free', 'HADR', 'Undefined' + /// Timestamp of last + /// Azure Defender status update. + /// Status of Azure Defender. + /// Possible values include: 'Protected', 'Unprotected', + /// 'Unknown' + /// The provisioning state of the + /// Arc-enabled SQL Server resource. + /// Timestamp of ESU + /// Expiration. + /// Type of host for Azure Arc SQL Server. + /// Possible values include: 'Virtual Machine', 'Physical Server', 'AWS + /// Virtual Machine', 'GCP Virtual Machine', 'Other' + public SqlServerInstanceProperties(string containerResourceId, string status, string version = default(string), string edition = default(string), string createTime = default(string), string vCore = default(string), string patchLevel = default(string), string collation = default(string), string currentVersion = default(string), string instanceName = default(string), string tcpDynamicPorts = default(string), string tcpStaticPorts = default(string), string productId = default(string), string licenseType = default(string), System.DateTime? azureDefenderStatusLastUpdated = default(System.DateTime?), string azureDefenderStatus = default(string), string provisioningState = default(string), System.DateTime? esuExpirationDate = default(System.DateTime?), string hostType = default(string)) + { + Version = version; + Edition = edition; + ContainerResourceId = containerResourceId; + CreateTime = createTime; + VCore = vCore; + Status = status; + PatchLevel = patchLevel; + Collation = collation; + CurrentVersion = currentVersion; + InstanceName = instanceName; + TcpDynamicPorts = tcpDynamicPorts; + TcpStaticPorts = tcpStaticPorts; + ProductId = productId; + LicenseType = licenseType; + AzureDefenderStatusLastUpdated = azureDefenderStatusLastUpdated; + AzureDefenderStatus = azureDefenderStatus; + ProvisioningState = provisioningState; + EsuExpirationDate = esuExpirationDate; + HostType = hostType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SQL Server version. Possible values include: 'SQL + /// Server 2012', 'SQL Server 2014', 'SQL Server 2016', 'SQL Server + /// 2017', 'SQL Server 2019', 'SQL Server 2022', 'Unknown' + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets SQL Server edition. Possible values include: + /// 'Evaluation', 'Enterprise', 'Standard', 'Web', 'Developer', + /// 'Express' + /// + [JsonProperty(PropertyName = "edition")] + public string Edition { get; set; } + + /// + /// Gets or sets ARM Resource id of the container resource (Azure Arc + /// for Servers). + /// + [JsonProperty(PropertyName = "containerResourceId")] + public string ContainerResourceId { get; set; } + + /// + /// Gets the time when the resource was created. + /// + [JsonProperty(PropertyName = "createTime")] + public string CreateTime { get; private set; } + + /// + /// Gets or sets the number of logical processors used by the SQL + /// Server instance. + /// + [JsonProperty(PropertyName = "vCore")] + public string VCore { get; set; } + + /// + /// Gets or sets the cloud connectivity status. Possible values + /// include: 'Connected', 'Disconnected', 'Registered', 'Unknown' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets SQL Server update level. + /// + [JsonProperty(PropertyName = "patchLevel")] + public string PatchLevel { get; set; } + + /// + /// Gets or sets SQL Server collation. + /// + [JsonProperty(PropertyName = "collation")] + public string Collation { get; set; } + + /// + /// Gets or sets SQL Server current version. + /// + [JsonProperty(PropertyName = "currentVersion")] + public string CurrentVersion { get; set; } + + /// + /// Gets or sets SQL Server instance name. + /// + [JsonProperty(PropertyName = "instanceName")] + public string InstanceName { get; set; } + + /// + /// Gets or sets dynamic TCP ports used by SQL Server. + /// + [JsonProperty(PropertyName = "tcpDynamicPorts")] + public string TcpDynamicPorts { get; set; } + + /// + /// Gets or sets static TCP ports used by SQL Server. + /// + [JsonProperty(PropertyName = "tcpStaticPorts")] + public string TcpStaticPorts { get; set; } + + /// + /// Gets or sets SQL Server product ID. + /// + [JsonProperty(PropertyName = "productId")] + public string ProductId { get; set; } + + /// + /// Gets or sets SQL Server license type. Possible values include: + /// 'Paid', 'Free', 'HADR', 'Undefined' + /// + [JsonProperty(PropertyName = "licenseType")] + public string LicenseType { get; set; } + + /// + /// Gets or sets timestamp of last Azure Defender status update. + /// + [JsonProperty(PropertyName = "azureDefenderStatusLastUpdated")] + public System.DateTime? AzureDefenderStatusLastUpdated { get; set; } + + /// + /// Gets or sets status of Azure Defender. Possible values include: + /// 'Protected', 'Unprotected', 'Unknown' + /// + [JsonProperty(PropertyName = "azureDefenderStatus")] + public string AzureDefenderStatus { get; set; } + + /// + /// Gets the provisioning state of the Arc-enabled SQL Server resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets timestamp of ESU Expiration. + /// + [JsonProperty(PropertyName = "esuExpirationDate")] + public System.DateTime? EsuExpirationDate { get; set; } + + /// + /// Gets or sets type of host for Azure Arc SQL Server. Possible values + /// include: 'Virtual Machine', 'Physical Server', 'AWS Virtual + /// Machine', 'GCP Virtual Machine', 'Other' + /// + [JsonProperty(PropertyName = "hostType")] + public string HostType { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs new file mode 100644 index 0000000000000..572595006a850 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlServerInstanceUpdate.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a SQL Server Instance. + /// + public partial class SqlServerInstanceUpdate + { + /// + /// Initializes a new instance of the SqlServerInstanceUpdate class. + /// + public SqlServerInstanceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlServerInstanceUpdate class. + /// + /// Resource tags. + public SqlServerInstanceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs new file mode 100644 index 0000000000000..99eddfef74f86 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SqlVersion.cs @@ -0,0 +1,27 @@ +// +// 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.AzureArcData.Models +{ + + /// + /// Defines values for SqlVersion. + /// + public static class SqlVersion + { + public const string SQLServer2012 = "SQL Server 2012"; + public const string SQLServer2014 = "SQL Server 2014"; + public const string SQLServer2016 = "SQL Server 2016"; + public const string SQLServer2017 = "SQL Server 2017"; + public const string SQLServer2019 = "SQL Server 2019"; + public const string SQLServer2022 = "SQL Server 2022"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..21fbeecc52071 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..e9ced259c46ad --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(id, name, type, systemData) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs new file mode 100644 index 0000000000000..d3a83c877158b --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadServicePrincipal.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service principal for uploading billing, metrics and logs. + /// + public partial class UploadServicePrincipal + { + /// + /// Initializes a new instance of the UploadServicePrincipal class. + /// + public UploadServicePrincipal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UploadServicePrincipal class. + /// + /// Client ID of the service principal for + /// uploading data. + /// Tenant ID of the service principal. + /// Authority for the service principal. + /// Example: https://login.microsoftonline.com/ + /// Secret of the service principal + public UploadServicePrincipal(System.Guid? clientId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), string authority = default(string), string clientSecret = default(string)) + { + ClientId = clientId; + TenantId = tenantId; + Authority = authority; + ClientSecret = clientSecret; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets client ID of the service principal for uploading data. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; set; } + + /// + /// Gets or sets tenant ID of the service principal. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets authority for the service principal. Example: + /// https://login.microsoftonline.com/ + /// + [JsonProperty(PropertyName = "authority")] + public string Authority { get; set; } + + /// + /// Gets or sets secret of the service principal + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs new file mode 100644 index 0000000000000..f7914d1324342 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Models/UploadWatermark.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties on upload watermark. Mostly timestamp for each upload data + /// type + /// + public partial class UploadWatermark + { + /// + /// Initializes a new instance of the UploadWatermark class. + /// + public UploadWatermark() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UploadWatermark class. + /// + /// Last uploaded date for metrics from + /// kubernetes cluster. Defaults to current date time + /// Last uploaded date for logs from kubernetes + /// cluster. Defaults to current date time + /// Last uploaded date for usages from kubernetes + /// cluster. Defaults to current date time + public UploadWatermark(System.DateTime? metrics = default(System.DateTime?), System.DateTime? logs = default(System.DateTime?), System.DateTime? usages = default(System.DateTime?)) + { + Metrics = metrics; + Logs = logs; + Usages = usages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets last uploaded date for metrics from kubernetes + /// cluster. Defaults to current date time + /// + [JsonProperty(PropertyName = "metrics")] + public System.DateTime? Metrics { get; set; } + + /// + /// Gets or sets last uploaded date for logs from kubernetes cluster. + /// Defaults to current date time + /// + [JsonProperty(PropertyName = "logs")] + public System.DateTime? Logs { get; set; } + + /// + /// Gets or sets last uploaded date for usages from kubernetes cluster. + /// Defaults to current date time + /// + [JsonProperty(PropertyName = "usages")] + public System.DateTime? Usages { get; set; } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs new file mode 100644 index 0000000000000..b693a95ac2306 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/Operations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.AzureArcData/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..9c52846cf2d80 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Azure Data Services on Azure Arc API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs new file mode 100644 index 0000000000000..328179d7f3152 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperations.cs @@ -0,0 +1,1587 @@ +// +// 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.AzureArcData +{ + 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; + + /// + /// PostgresInstancesOperations operations. + /// + internal partial class PostgresInstancesOperations : IServiceOperations, IPostgresInstancesOperations + { + /// + /// Initializes a new instance of the PostgresInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PostgresInstancesOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List postgres Instance resources in the subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/postgresInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres 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> GetWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("postgresInstanceName", postgresInstanceName); + 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.AzureArcData/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, resource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("postgresInstanceName", postgresInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.AzureArcData/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string postgresInstanceName, PostgresInstance resource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (resource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resource"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("postgresInstanceName", postgresInstanceName); + tracingParameters.Add("resource", resource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.AzureArcData/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(resource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// 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 postgresInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (postgresInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "postgresInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("postgresInstanceName", postgresInstanceName); + 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.AzureArcData/postgresInstances/{postgresInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{postgresInstanceName}", System.Uri.EscapeDataString(postgresInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..befd459d81ad2 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/PostgresInstancesOperationsExtensions.cs @@ -0,0 +1,419 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PostgresInstancesOperations. + /// + public static partial class PostgresInstancesOperationsExtensions + { + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IPostgresInstancesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPostgresInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListByResourceGroup(this IPostgresInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IPostgresInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + public static PostgresInstance Get(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName) + { + return operations.GetAsync(resourceGroupName, postgresInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + public static PostgresInstance Create(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource) + { + return operations.CreateAsync(resourceGroupName, postgresInstanceName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + public static void Delete(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName) + { + operations.DeleteAsync(resourceGroupName, postgresInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres Instance. + /// + public static PostgresInstance Update(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, postgresInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The Postgres Instance. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstanceUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + public static PostgresInstance BeginCreate(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource) + { + return operations.BeginCreateAsync(resourceGroupName, postgresInstanceName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The postgres instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, PostgresInstance resource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + public static void BeginDelete(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName) + { + operations.BeginDeleteAsync(resourceGroupName, postgresInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a postgres Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of Postgres Instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPostgresInstancesOperations operations, string resourceGroupName, string postgresInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, postgresInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPostgresInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IPostgresInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IPostgresInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List postgres Instance resources in the resource group + /// + /// + /// Get a postgres Instances list by Resource group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IPostgresInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs new file mode 100644 index 0000000000000..40db224786b81 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SdkInfo_AzureArcDataManagementClient.cs @@ -0,0 +1,32 @@ + +// +// 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.AzureArcData +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureArcDataManagementClient + { + get + { + return new Tuple[] + { + new Tuple("AzureArcData", "ActiveDirectoryConnectors", "2022-03-01-preview"), + new Tuple("AzureArcData", "DataControllers", "2022-03-01-preview"), + new Tuple("AzureArcData", "Operations", "2022-03-01-preview"), + new Tuple("AzureArcData", "PostgresInstances", "2022-03-01-preview"), + new Tuple("AzureArcData", "SqlManagedInstances", "2022-03-01-preview"), + new Tuple("AzureArcData", "SqlServerInstances", "2022-03-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs new file mode 100644 index 0000000000000..55fcdde4a4258 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperations.cs @@ -0,0 +1,1588 @@ +// +// 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.AzureArcData +{ + 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; + + /// + /// SqlManagedInstancesOperations operations. + /// + internal partial class SqlManagedInstancesOperations : IServiceOperations, ISqlManagedInstancesOperations + { + /// + /// Initializes a new instance of the SqlManagedInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SqlManagedInstancesOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL 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> GetWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + 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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + SqlManagedInstanceUpdate parameters = new SqlManagedInstanceUpdate(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (sqlManagedInstance == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstance"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + tracingParameters.Add("sqlManagedInstance", sqlManagedInstance); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sqlManagedInstance != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlManagedInstance, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// 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 sqlManagedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlManagedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlManagedInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlManagedInstanceName", sqlManagedInstanceName); + 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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlManagedInstanceName}", System.Uri.EscapeDataString(sqlManagedInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..53325b4d15074 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlManagedInstancesOperationsExtensions.cs @@ -0,0 +1,421 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlManagedInstancesOperations. + /// + public static partial class SqlManagedInstancesOperationsExtensions + { + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISqlManagedInstancesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISqlManagedInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListByResourceGroup(this ISqlManagedInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + public static SqlManagedInstance Get(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + return operations.GetAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + public static SqlManagedInstance Create(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance) + { + return operations.CreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + public static void Delete(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + operations.DeleteAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// Resource tags. + /// + public static SqlManagedInstance Update(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sqlManagedInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + public static SqlManagedInstance BeginCreate(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance) + { + return operations.BeginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The SQL Managed Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, SqlManagedInstance sqlManagedInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + public static void BeginDelete(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName) + { + operations.BeginDeleteAsync(resourceGroupName, sqlManagedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Managed Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Managed Instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISqlManagedInstancesOperations operations, string resourceGroupName, string sqlManagedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlManagedInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISqlManagedInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISqlManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISqlManagedInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlManagedInstance resources in the resource group + /// + /// + /// Gets all sqlManagedInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISqlManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs new file mode 100644 index 0000000000000..723134a9208d4 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperations.cs @@ -0,0 +1,1588 @@ +// +// 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.AzureArcData +{ + 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; + + /// + /// SqlServerInstancesOperations operations. + /// + internal partial class SqlServerInstancesOperations : IServiceOperations, ISqlServerInstancesOperations + { + /// + /// Initializes a new instance of the SqlServerInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SqlServerInstancesOperations(AzureArcDataManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureArcDataManagementClient + /// + public AzureArcDataManagementClient Client { get; private set; } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server 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> GetWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + 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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + SqlServerInstanceUpdate parameters = new SqlServerInstanceUpdate(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (sqlServerInstance == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstance"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + tracingParameters.Add("sqlServerInstance", sqlServerInstance); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sqlServerInstance != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlServerInstance, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// 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 sqlServerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlServerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlServerInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlServerInstanceName", sqlServerInstanceName); + 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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlServerInstanceName}", System.Uri.EscapeDataString(sqlServerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..5beb119c1e2c6 --- /dev/null +++ b/sdk/azurearcdata/Microsoft.Azure.Management.AzureArcData/src/Generated/SqlServerInstancesOperationsExtensions.cs @@ -0,0 +1,421 @@ +// +// 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.AzureArcData +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlServerInstancesOperations. + /// + public static partial class SqlServerInstancesOperationsExtensions + { + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISqlServerInstancesOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISqlServerInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + public static IPage ListByResourceGroup(this ISqlServerInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + public static SqlServerInstance Get(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + return operations.GetAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + public static SqlServerInstance Create(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance) + { + return operations.CreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + public static void Delete(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + operations.DeleteAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Resource tags. + /// + public static SqlServerInstance Update(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sqlServerInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + public static SqlServerInstance BeginCreate(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance) + { + return operations.BeginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).GetAwaiter().GetResult(); + } + + /// + /// Creates or replaces a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The SQL Server Instance to be created or updated. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, SqlServerInstance sqlServerInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + public static void BeginDelete(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName) + { + operations.BeginDeleteAsync(resourceGroupName, sqlServerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SQL Server Instance resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure resource group + /// + /// + /// Name of SQL Server Instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISqlServerInstancesOperations operations, string resourceGroupName, string sqlServerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlServerInstanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISqlServerInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISqlServerInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISqlServerInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List sqlServerInstance resources in the resource group + /// + /// + /// Gets all sqlServerInstances in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISqlServerInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}