diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/BigDataPools.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/BigDataPools.cs new file mode 100644 index 000000000000..f279530539e4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/BigDataPools.cs @@ -0,0 +1,1164 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BigDataPools operations. + /// + public partial class BigDataPools : IServiceOperations, IBigDataPools + { + /// + /// Initializes a new instance of the BigDataPools class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public BigDataPools(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get Big Data pool + /// + /// + /// Get a Big Data pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bigDataPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (bigDataPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bigDataPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bigDataPoolName", bigDataPoolName); + 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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bigDataPoolName}", System.Uri.EscapeDataString(bigDataPoolName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a Big Data pool. + /// + /// + /// Patch a Big Data pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The updated Big Data pool properties + /// + /// + /// 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 workspaceName, string bigDataPoolName, BigDataPoolPatchInfo bigDataPoolPatchInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (bigDataPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bigDataPoolName"); + } + if (bigDataPoolPatchInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bigDataPoolPatchInfo"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bigDataPoolName", bigDataPoolName); + tracingParameters.Add("bigDataPoolPatchInfo", bigDataPoolPatchInfo); + 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.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bigDataPoolName}", System.Uri.EscapeDataString(bigDataPoolName)); + 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 += "?" + 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 (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(bigDataPoolPatchInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bigDataPoolPatchInfo, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a Big Data pool. + /// + /// + /// Create a new Big Data pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The Big Data pool to create. + /// + /// + /// Whether to stop any running jobs in the Big Data pool + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bigDataPoolName, BigDataPoolResourceInfo bigDataPoolInfo, bool? force = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (bigDataPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bigDataPoolName"); + } + if (bigDataPoolInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bigDataPoolInfo"); + } + if (bigDataPoolInfo != null) + { + bigDataPoolInfo.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bigDataPoolName", bigDataPoolName); + tracingParameters.Add("force", force); + tracingParameters.Add("bigDataPoolInfo", bigDataPoolInfo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bigDataPoolName}", System.Uri.EscapeDataString(bigDataPoolName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (force != null) + { + _queryParameters.Add(string.Format("force={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(force, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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(bigDataPoolInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bigDataPoolInfo, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a Big Data pool. + /// + /// + /// Delete a Big Data pool from the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bigDataPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (bigDataPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bigDataPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bigDataPoolName", bigDataPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bigDataPoolName}", System.Uri.EscapeDataString(bigDataPoolName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the Big Data pools in a workspace. + /// + /// + /// List Big Data pools in a workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.Synapse/workspaces/{workspaceName}/bigDataPools").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/BigDataPoolsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/BigDataPoolsExtensions.cs new file mode 100644 index 000000000000..7b9d81f61147 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/BigDataPoolsExtensions.cs @@ -0,0 +1,295 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BigDataPools. + /// + public static partial class BigDataPoolsExtensions + { + /// + /// Get Big Data pool + /// + /// + /// Get a Big Data pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + public static BigDataPoolResourceInfo Get(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, bigDataPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get Big Data pool + /// + /// + /// Get a Big Data pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, bigDataPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Big Data pool. + /// + /// + /// Patch a Big Data pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The updated Big Data pool properties + /// + public static BigDataPoolResourceInfo Update(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName, BigDataPoolPatchInfo bigDataPoolPatchInfo) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolPatchInfo).GetAwaiter().GetResult(); + } + + /// + /// Update a Big Data pool. + /// + /// + /// Patch a Big Data pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The updated Big Data pool properties + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName, BigDataPoolPatchInfo bigDataPoolPatchInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolPatchInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a Big Data pool. + /// + /// + /// Create a new Big Data pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The Big Data pool to create. + /// + /// + /// Whether to stop any running jobs in the Big Data pool + /// + public static BigDataPoolResourceInfo CreateOrUpdate(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName, BigDataPoolResourceInfo bigDataPoolInfo, bool? force = false) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolInfo, force).GetAwaiter().GetResult(); + } + + /// + /// Create a Big Data pool. + /// + /// + /// Create a new Big Data pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The Big Data pool to create. + /// + /// + /// Whether to stop any running jobs in the Big Data pool + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName, BigDataPoolResourceInfo bigDataPoolInfo, bool? force = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, bigDataPoolName, bigDataPoolInfo, force, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Big Data pool. + /// + /// + /// Delete a Big Data pool from the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + public static object Delete(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName) + { + return operations.DeleteAsync(resourceGroupName, workspaceName, bigDataPoolName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Big Data pool. + /// + /// + /// Delete a Big Data pool from the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBigDataPools operations, string resourceGroupName, string workspaceName, string bigDataPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, bigDataPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the Big Data pools in a workspace. + /// + /// + /// List Big Data pools in a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static BigDataPoolResourceInfoListResult ListByWorkspace(this IBigDataPools operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// List the Big Data pools in a workspace. + /// + /// + /// List Big Data pools in a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task ListByWorkspaceAsync(this IBigDataPools operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IBigDataPools.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IBigDataPools.cs new file mode 100644 index 000000000000..d876cecff5c5 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IBigDataPools.cs @@ -0,0 +1,187 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BigDataPools operations. + /// + public partial interface IBigDataPools + { + /// + /// Get Big Data pool + /// + /// + /// Get a Big Data pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bigDataPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Big Data pool. + /// + /// + /// Patch a Big Data pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The updated Big Data pool properties + /// + /// + /// 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 workspaceName, string bigDataPoolName, BigDataPoolPatchInfo bigDataPoolPatchInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a Big Data pool. + /// + /// + /// Create a new Big Data pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The Big Data pool to create. + /// + /// + /// Whether to stop any running jobs in the Big Data pool + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bigDataPoolName, BigDataPoolResourceInfo bigDataPoolInfo, bool? force = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Big Data pool. + /// + /// + /// Delete a Big Data pool from the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Big Data pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bigDataPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the Big Data pools in a workspace. + /// + /// + /// List Big Data pools in a workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IIpFirewallRules.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IIpFirewallRules.cs new file mode 100644 index 000000000000..9272c9b0f60e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IIpFirewallRules.cs @@ -0,0 +1,138 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IpFirewallRules operations. + /// + public partial interface IIpFirewallRules + { + /// + /// Returns a list of firewall rules + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a firewall rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// IP firewall rule properties + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleName, IpFirewallRuleInfo ipFirewallRuleInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a firewall rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Replaces firewall rules + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Replace all IP firewall rules request + /// + /// + /// 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> ReplaceAllWithHttpMessagesAsync(string resourceGroupName, string workspaceName, ReplaceAllIpFirewallRulesRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IOperations.cs new file mode 100644 index 000000000000..1c8187b86d6b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IOperations.cs @@ -0,0 +1,129 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Check name availability + /// + /// + /// Check whether a workspace name is available + /// + /// + /// The check request + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// All operations + /// + /// + /// Get all available 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 + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get operation result + /// + /// + /// Get the result of an operation + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + /// + /// 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 GetLocationHeaderResultWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get operation status + /// + /// + /// Get the status of an operation + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + /// + /// 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> GetAzureAsyncHeaderResultWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolBlobAuditingPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolBlobAuditingPolicies.cs new file mode 100644 index 000000000000..e540f1a640c4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolBlobAuditingPolicies.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolBlobAuditingPolicies operations. + /// + public partial interface ISqlPoolBlobAuditingPolicies + { + /// + /// Get a SQL pool's blob auditing policy + /// + /// + /// Get a SQL pool's blob auditing policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a SQL pool's blob auditing policy + /// + /// + /// Creates or updates a SQL pool's blob auditing policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The database blob auditing policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolBlobAuditingPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolConnectionPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolConnectionPolicies.cs new file mode 100644 index 000000000000..31c5b5284361 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolConnectionPolicies.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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolConnectionPolicies operations. + /// + public partial interface ISqlPoolConnectionPolicies + { + /// + /// Get a Sql pool's connection policy, which is used with table + /// auditing + /// + /// + /// Get a Sql pool's connection policy, which is used with table + /// auditing. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolDataWarehouseUserActivities.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolDataWarehouseUserActivities.cs new file mode 100644 index 000000000000..3448917b1281 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolDataWarehouseUserActivities.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolDataWarehouseUserActivities operations. + /// + public partial interface ISqlPoolDataWarehouseUserActivities + { + /// + /// Get SQL pool user activities + /// + /// + /// Gets the user activities of a SQL pool which includes running and + /// suspended queries + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolGeoBackupPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolGeoBackupPolicies.cs new file mode 100644 index 000000000000..6d6f0798ec03 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolGeoBackupPolicies.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolGeoBackupPolicies operations. + /// + public partial interface ISqlPoolGeoBackupPolicies + { + /// + /// Get a SQL pool geo backup policy + /// + /// + /// Get the specified SQL pool geo backup policy + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolMetadataSyncConfigs.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolMetadataSyncConfigs.cs new file mode 100644 index 000000000000..d9dd9d141bcf --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolMetadataSyncConfigs.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolMetadataSyncConfigs operations. + /// + public partial interface ISqlPoolMetadataSyncConfigs + { + /// + /// Get SQL pool metadata sync config + /// + /// + /// Get the metadata sync configuration for a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Set SQL pool metadata sync config + /// + /// + /// Set the metadata sync configuration for a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Metadata sync configuration + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, MetadataSyncConfig metadataSyncConfiguration, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolOperationResults.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolOperationResults.cs new file mode 100644 index 000000000000..ce837df95456 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolOperationResults.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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolOperationResults operations. + /// + public partial interface ISqlPoolOperationResults + { + /// + /// Get SQL pool operation status + /// + /// + /// Get the status of a SQL pool operation + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Operation ID + /// + /// + /// 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> GetLocationHeaderResultWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolOperations.cs new file mode 100644 index 000000000000..3f7f673658ca --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolOperations.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolOperations operations. + /// + public partial interface ISqlPoolOperations + { + /// + /// Gets a list of operations performed on the SQL pool + /// + /// + /// Gets a list of operations performed on the SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolReplicationLinks.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolReplicationLinks.cs new file mode 100644 index 000000000000..871f61f4f529 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolReplicationLinks.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolReplicationLinks operations. + /// + public partial interface ISqlPoolReplicationLinks + { + /// + /// Get SQL pool replication links + /// + /// + /// Lists a Sql pool's replication links. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolRestorePoints.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolRestorePoints.cs new file mode 100644 index 000000000000..166b1975d984 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolRestorePoints.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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolRestorePoints operations. + /// + public partial interface ISqlPoolRestorePoints + { + /// + /// Get SQL pool backup + /// + /// + /// Get SQL pool backup information + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a restore point for a data warehouse. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The definition for creating the restore point of this Sql pool. + /// + /// + /// 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 workspaceName, string sqlPoolName, CreateSqlPoolRestorePointDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSchemas.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSchemas.cs new file mode 100644 index 000000000000..b4b9d9bd5129 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSchemas.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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolSchemas operations. + /// + public partial interface ISqlPoolSchemas + { + /// + /// Gets schemas of a given SQL pool + /// + /// + /// Gets schemas of a given SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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 workspaceName, string sqlPoolName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSecurityAlertPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSecurityAlertPolicies.cs new file mode 100644 index 000000000000..25f1f19be639 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSecurityAlertPolicies.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolSecurityAlertPolicies operations. + /// + public partial interface ISqlPoolSecurityAlertPolicies + { + /// + /// Get a Sql pool's security alert policy + /// + /// + /// Get a Sql pool's security alert policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a Sql pool's security alert policy + /// + /// + /// Create or update a Sql pool's security alert policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The Sql pool security alert policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSensitivityLabels.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSensitivityLabels.cs new file mode 100644 index 000000000000..b450145a8dc9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolSensitivityLabels.cs @@ -0,0 +1,245 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolSensitivityLabels operations. + /// + public partial interface ISqlPoolSensitivityLabels + { + /// + /// Gets SQL pool sensitivity labels + /// + /// + /// Gets SQL pool sensitivity labels. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListCurrentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets sensitivity labels of a given SQL pool + /// + /// + /// Gets sensitivity labels of a given SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Specifies whether to include disabled recommendations or not. + /// + /// + /// An OData query option to indicate how many elements to skip in the + /// collection. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListRecommendedWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the sensitivity label of a given column in a Sql + /// pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The column sensitivity label 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the sensitivity label of a given column in a Sql pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// 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 workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Enables sensitivity recommendations on a given column + /// (recommendations are enabled by default on all columns) + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// 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 EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Disables sensitivity recommendations on a given column + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// 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 DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTableColumns.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTableColumns.cs new file mode 100644 index 000000000000..f2c2d0d94b12 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTableColumns.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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolTableColumns operations. + /// + public partial interface ISqlPoolTableColumns + { + /// + /// Gets columns in a given table in a SQL pool + /// + /// + /// Gets columns in a given table in a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListByTableNameWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTables.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTables.cs new file mode 100644 index 000000000000..55e2dbe49e5c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTables.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolTables operations. + /// + public partial interface ISqlPoolTables + { + /// + /// Gets tables of a given schema in a SQL pool + /// + /// + /// Gets tables of a given schema in a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTransparentDataEncryptions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTransparentDataEncryptions.cs new file mode 100644 index 000000000000..7a4cd749f45c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolTransparentDataEncryptions.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolTransparentDataEncryptions operations. + /// + public partial interface ISqlPoolTransparentDataEncryptions + { + /// + /// Get a SQL pool's transparent data encryption configuration + /// + /// + /// Get a SQL pool's transparent data encryption configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Sql pool's transparent data encryption + /// configuration + /// + /// + /// Creates or updates a Sql pool's transparent data encryption + /// configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The required parameters for creating or updating transparent data + /// encryption. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolUsages.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolUsages.cs new file mode 100644 index 000000000000..91fe3d0ac2fb --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolUsages.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolUsages operations. + /// + public partial interface ISqlPoolUsages + { + /// + /// Gets SQL pool usages + /// + /// + /// Gets SQL pool usages. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessmentRuleBaselines.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessmentRuleBaselines.cs new file mode 100644 index 000000000000..3f1d70f6abf7 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessmentRuleBaselines.cs @@ -0,0 +1,99 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolVulnerabilityAssessmentRuleBaselines operations. + /// + public partial interface ISqlPoolVulnerabilityAssessmentRuleBaselines + { + /// + /// Creates or updates a Sql pool's vulnerability assessment rule + /// baseline. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default + /// implies a baseline on a Sql pool level rule and master for + /// workspace level rule). Possible values include: 'master', 'default' + /// + /// + /// The requested rule baseline 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, SqlPoolVulnerabilityAssessmentRuleBaseline parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Removes the database's vulnerability assessment rule baseline. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default + /// implies a baseline on a Sql pool level rule and master for + /// workspace level rule). Possible values include: 'master', 'default' + /// + /// + /// 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 workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessmentScans.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessmentScans.cs new file mode 100644 index 000000000000..5a31421399d2 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessmentScans.cs @@ -0,0 +1,117 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolVulnerabilityAssessmentScans operations. + /// + public partial interface ISqlPoolVulnerabilityAssessmentScans + { + /// + /// Lists the vulnerability assessment scans of a SQL pool + /// + /// + /// Lists the vulnerability assessment scans of a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Executes a Vulnerability Assessment database scan. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// 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 InitiateScanWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Convert an existing scan result to a human readable format. If + /// already exists nothing happens + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// 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> ExportWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessments.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessments.cs new file mode 100644 index 000000000000..afad5b4c7a48 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPoolVulnerabilityAssessments.cs @@ -0,0 +1,152 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolVulnerabilityAssessments operations. + /// + public partial interface ISqlPoolVulnerabilityAssessments + { + /// + /// Lists the vulnerability assessment policies associated with a SQL + /// pool + /// + /// + /// Lists the vulnerability assessment policies associated with a SQL + /// pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the Sql pool's vulnerability assessment + /// + /// + /// Gets the Sql pool's vulnerability assessment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the Sql pool vulnerability assessment + /// + /// + /// Creates or updates the Sql pool vulnerability assessment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The requested 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolVulnerabilityAssessment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Removes the database's vulnerability assessment + /// + /// + /// Removes the database's vulnerability assessment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPools.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPools.cs new file mode 100644 index 000000000000..b835463ca955 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISqlPools.cs @@ -0,0 +1,277 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPools operations. + /// + public partial interface ISqlPools + { + /// + /// Get SQL pool + /// + /// + /// Get SQL pool properties + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update SQL pool + /// + /// + /// Apply a partial update to a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The updated SQL pool properties + /// + /// + /// 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 workspaceName, string sqlPoolName, SqlPoolPatchInfo sqlPoolInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create SQL pool + /// + /// + /// Create a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The SQL pool to create + /// + /// + /// 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 workspaceName, string sqlPoolName, SqlPool sqlPoolInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete SQL pool + /// + /// + /// Delete a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List SQL pools + /// + /// + /// List all SQL pools + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Pause SQL pool + /// + /// + /// Pause a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PauseWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resume SQL pool + /// + /// + /// Resume a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Rename a SQL pool + /// + /// + /// Rename a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The resource move definition for renaming this Sql pool. + /// + /// + /// 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 RenameWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs new file mode 100644 index 000000000000..2ce387d6d876 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs @@ -0,0 +1,178 @@ +// +// 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.Synapse +{ + using Models; + using Newtonsoft.Json; + + /// + /// Azure Synapse Analytics Management Client + /// + public partial interface ISynapseManagementClient : 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; } + + /// + /// The ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; set; } + + + /// + /// Gets the IBigDataPools. + /// + IBigDataPools BigDataPools { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IIpFirewallRules. + /// + IIpFirewallRules IpFirewallRules { get; } + + /// + /// Gets the ISqlPools. + /// + ISqlPools SqlPools { get; } + + /// + /// Gets the ISqlPoolMetadataSyncConfigs. + /// + ISqlPoolMetadataSyncConfigs SqlPoolMetadataSyncConfigs { get; } + + /// + /// Gets the ISqlPoolOperationResults. + /// + ISqlPoolOperationResults SqlPoolOperationResults { get; } + + /// + /// Gets the ISqlPoolGeoBackupPolicies. + /// + ISqlPoolGeoBackupPolicies SqlPoolGeoBackupPolicies { get; } + + /// + /// Gets the ISqlPoolDataWarehouseUserActivities. + /// + ISqlPoolDataWarehouseUserActivities SqlPoolDataWarehouseUserActivities { get; } + + /// + /// Gets the ISqlPoolRestorePoints. + /// + ISqlPoolRestorePoints SqlPoolRestorePoints { get; } + + /// + /// Gets the ISqlPoolReplicationLinks. + /// + ISqlPoolReplicationLinks SqlPoolReplicationLinks { get; } + + /// + /// Gets the ISqlPoolTransparentDataEncryptions. + /// + ISqlPoolTransparentDataEncryptions SqlPoolTransparentDataEncryptions { get; } + + /// + /// Gets the ISqlPoolBlobAuditingPolicies. + /// + ISqlPoolBlobAuditingPolicies SqlPoolBlobAuditingPolicies { get; } + + /// + /// Gets the ISqlPoolOperations. + /// + ISqlPoolOperations SqlPoolOperations { get; } + + /// + /// Gets the ISqlPoolUsages. + /// + ISqlPoolUsages SqlPoolUsages { get; } + + /// + /// Gets the ISqlPoolSensitivityLabels. + /// + ISqlPoolSensitivityLabels SqlPoolSensitivityLabels { get; } + + /// + /// Gets the ISqlPoolSchemas. + /// + ISqlPoolSchemas SqlPoolSchemas { get; } + + /// + /// Gets the ISqlPoolTables. + /// + ISqlPoolTables SqlPoolTables { get; } + + /// + /// Gets the ISqlPoolTableColumns. + /// + ISqlPoolTableColumns SqlPoolTableColumns { get; } + + /// + /// Gets the ISqlPoolConnectionPolicies. + /// + ISqlPoolConnectionPolicies SqlPoolConnectionPolicies { get; } + + /// + /// Gets the ISqlPoolVulnerabilityAssessments. + /// + ISqlPoolVulnerabilityAssessments SqlPoolVulnerabilityAssessments { get; } + + /// + /// Gets the ISqlPoolVulnerabilityAssessmentScans. + /// + ISqlPoolVulnerabilityAssessmentScans SqlPoolVulnerabilityAssessmentScans { get; } + + /// + /// Gets the ISqlPoolSecurityAlertPolicies. + /// + ISqlPoolSecurityAlertPolicies SqlPoolSecurityAlertPolicies { get; } + + /// + /// Gets the ISqlPoolVulnerabilityAssessmentRuleBaselines. + /// + ISqlPoolVulnerabilityAssessmentRuleBaselines SqlPoolVulnerabilityAssessmentRuleBaselines { get; } + + /// + /// Gets the IWorkspaces. + /// + IWorkspaces Workspaces { get; } + + /// + /// Gets the IWorkspaceAadAdmins. + /// + IWorkspaceAadAdmins WorkspaceAadAdmins { get; } + + /// + /// Gets the IWorkspaceManagedIdentitySqlControlSettings. + /// + IWorkspaceManagedIdentitySqlControlSettings WorkspaceManagedIdentitySqlControlSettings { get; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceAadAdmins.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceAadAdmins.cs new file mode 100644 index 000000000000..c4fa06a27f4c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceAadAdmins.cs @@ -0,0 +1,101 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceAadAdmins operations. + /// + public partial interface IWorkspaceAadAdmins + { + /// + /// Gets a workspace active directory admin + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a workspace active directory admin + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace active directory administrator properties + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspaceAadAdminInfo aadAdminInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a workspace active directory admin + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedIdentitySqlControlSettings.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedIdentitySqlControlSettings.cs new file mode 100644 index 000000000000..7ac75a94bd13 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedIdentitySqlControlSettings.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceManagedIdentitySqlControlSettings operations. + /// + public partial interface IWorkspaceManagedIdentitySqlControlSettings + { + /// + /// Get Managed Identity Sql Control Settings + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update Managed Identity Sql Control Settings + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Managed Identity Sql Control Settings + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, ManagedIdentitySqlControlSettingsModel managedIdentitySqlControlSettings, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaces.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaces.cs new file mode 100644 index 000000000000..7bd48d3e3265 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaces.cs @@ -0,0 +1,173 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Workspaces operations. + /// + public partial interface IWorkspaces + { + /// + /// Returns a list of workspaces in a resource group + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace patch request properties + /// + /// + /// 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 workspaceName, WorkspacePatchInfo workspacePatchInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace create or update request properties + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace workspaceInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of workspaces in a 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)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IpFirewallRules.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IpFirewallRules.cs new file mode 100644 index 000000000000..91589eac96f7 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IpFirewallRules.cs @@ -0,0 +1,896 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IpFirewallRules operations. + /// + public partial class IpFirewallRules : IServiceOperations, IIpFirewallRules + { + /// + /// Initializes a new instance of the IpFirewallRules class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public IpFirewallRules(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Returns a list of firewall rules + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.Synapse/workspaces/{workspaceName}/firewallRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a firewall rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// IP firewall rule properties + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleName, IpFirewallRuleInfo ipFirewallRuleInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + if (ipFirewallRuleInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipFirewallRuleInfo"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("ipFirewallRuleInfo", ipFirewallRuleInfo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + 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 += "?" + 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 (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(ipFirewallRuleInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(ipFirewallRuleInfo, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 firewall rule + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (ruleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleName", ruleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Replaces firewall rules + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Replace all IP firewall rules request + /// + /// + /// 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> ReplaceAllWithHttpMessagesAsync(string resourceGroupName, string workspaceName, ReplaceAllIpFirewallRulesRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "request"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("request", request); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ReplaceAll", 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.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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(request != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(request, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IpFirewallRulesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IpFirewallRulesExtensions.cs new file mode 100644 index 000000000000..06ce2d85f1e6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IpFirewallRulesExtensions.cs @@ -0,0 +1,207 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IpFirewallRules. + /// + public static partial class IpFirewallRulesExtensions + { + /// + /// Returns a list of firewall rules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static IpFirewallRuleInfoListResult ListByWorkspace(this IIpFirewallRules operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of firewall rules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task ListByWorkspaceAsync(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a firewall rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// IP firewall rule properties + /// + public static IpFirewallRuleInfo CreateOrUpdate(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, string ruleName, IpFirewallRuleInfo ipFirewallRuleInfo) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, ruleName, ipFirewallRuleInfo).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a firewall rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// IP firewall rule properties + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, string ruleName, IpFirewallRuleInfo ipFirewallRuleInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleName, ipFirewallRuleInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a firewall rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + public static object Delete(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, string ruleName) + { + return operations.DeleteAsync(resourceGroupName, workspaceName, ruleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a firewall rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The IP firewall rule name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Replaces firewall rules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Replace all IP firewall rules request + /// + public static ReplaceAllFirewallRulesOperationResponse ReplaceAll(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, ReplaceAllIpFirewallRulesRequest request) + { + return operations.ReplaceAllAsync(resourceGroupName, workspaceName, request).GetAwaiter().GetResult(); + } + + /// + /// Replaces firewall rules + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Replace all IP firewall rules request + /// + /// + /// The cancellation token. + /// + public static async Task ReplaceAllAsync(this IIpFirewallRules operations, string resourceGroupName, string workspaceName, ReplaceAllIpFirewallRulesRequest request, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ReplaceAllWithHttpMessagesAsync(resourceGroupName, workspaceName, request, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AutoPauseProperties.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AutoPauseProperties.cs new file mode 100644 index 000000000000..fa50cd32f1bc --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AutoPauseProperties.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Spark pool auto-pausing properties + /// + /// + /// Auto-pausing properties of a Big Data pool powered by Apache Spark + /// + public partial class AutoPauseProperties + { + /// + /// Initializes a new instance of the AutoPauseProperties class. + /// + public AutoPauseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoPauseProperties class. + /// + /// Number of minutes of idle time before + /// the Big Data pool is automatically paused. + /// Whether auto-pausing is enabled for the Big + /// Data pool. + public AutoPauseProperties(int? delayInMinutes = default(int?), bool? enabled = default(bool?)) + { + DelayInMinutes = delayInMinutes; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of minutes of idle time before the Big Data + /// pool is automatically paused. + /// + [JsonProperty(PropertyName = "delayInMinutes")] + public int? DelayInMinutes { get; set; } + + /// + /// Gets or sets whether auto-pausing is enabled for the Big Data pool. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AutoScaleProperties.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AutoScaleProperties.cs new file mode 100644 index 000000000000..91042be6380c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AutoScaleProperties.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Spark pool auto-scaling properties + /// + /// + /// Auto-scaling properties of a Big Data pool powered by Apache Spark + /// + public partial class AutoScaleProperties + { + /// + /// Initializes a new instance of the AutoScaleProperties class. + /// + public AutoScaleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScaleProperties class. + /// + /// The minimum number of nodes the Big Data + /// pool can support. + /// Whether automatic scaling is enabled for the + /// Big Data pool. + /// The maximum number of nodes the Big Data + /// pool can support. + public AutoScaleProperties(int? minNodeCount = default(int?), bool? enabled = default(bool?), int? maxNodeCount = default(int?)) + { + MinNodeCount = minNodeCount; + Enabled = enabled; + MaxNodeCount = maxNodeCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum number of nodes the Big Data pool can + /// support. + /// + [JsonProperty(PropertyName = "minNodeCount")] + public int? MinNodeCount { get; set; } + + /// + /// Gets or sets whether automatic scaling is enabled for the Big Data + /// pool. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the maximum number of nodes the Big Data pool can + /// support. + /// + [JsonProperty(PropertyName = "maxNodeCount")] + public int? MaxNodeCount { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AvailableRpOperation.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AvailableRpOperation.cs new file mode 100644 index 000000000000..11705a4036fd --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AvailableRpOperation.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An operation that is available in this resource provider + /// + [Rest.Serialization.JsonTransformation] + public partial class AvailableRpOperation + { + /// + /// Initializes a new instance of the AvailableRpOperation class. + /// + public AvailableRpOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableRpOperation class. + /// + /// Display properties of the operation + /// Whether this operation is a data + /// action + /// Operation name + /// Operation service + /// specification + /// Operation origin + public AvailableRpOperation(AvailableRpOperationDisplayInfo display = default(AvailableRpOperationDisplayInfo), string isDataAction = default(string), string name = default(string), OperationMetaServiceSpecification serviceSpecification = default(OperationMetaServiceSpecification), string origin = default(string)) + { + Display = display; + IsDataAction = isDataAction; + Name = name; + ServiceSpecification = serviceSpecification; + Origin = origin; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display properties of the operation + /// + [JsonProperty(PropertyName = "display")] + public AvailableRpOperationDisplayInfo Display { get; set; } + + /// + /// Gets or sets whether this operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public string IsDataAction { get; set; } + + /// + /// Gets or sets operation name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets operation service specification + /// + [JsonProperty(PropertyName = "properties.serviceSpecification")] + public OperationMetaServiceSpecification ServiceSpecification { get; set; } + + /// + /// Gets or sets operation origin + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AvailableRpOperationDisplayInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AvailableRpOperationDisplayInfo.cs new file mode 100644 index 000000000000..8718aabfac21 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AvailableRpOperationDisplayInfo.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Description of an available operation + /// + public partial class AvailableRpOperationDisplayInfo + { + /// + /// Initializes a new instance of the AvailableRpOperationDisplayInfo + /// class. + /// + public AvailableRpOperationDisplayInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableRpOperationDisplayInfo + /// class. + /// + /// Operation description + /// Resource type + /// Resource provider name + /// Operation name + public AvailableRpOperationDisplayInfo(string description = default(string), string resource = default(string), string provider = default(string), string operation = default(string)) + { + Description = description; + Resource = resource; + Provider = provider; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets resource type + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets resource provider name + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets operation name + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureEntityResource.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..5a6e30bb64a7 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureEntityResource.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition for a 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolPatchInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolPatchInfo.cs new file mode 100644 index 000000000000..311a9f47fdea --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolPatchInfo.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Patch for a Big Data pool + /// + /// + /// Properties patch for a Big Data pool + /// + public partial class BigDataPoolPatchInfo + { + /// + /// Initializes a new instance of the BigDataPoolPatchInfo class. + /// + public BigDataPoolPatchInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BigDataPoolPatchInfo class. + /// + /// Updated tags for the Big Data pool + public BigDataPoolPatchInfo(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets updated tags for the Big Data pool + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolResourceInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolResourceInfo.cs new file mode 100644 index 000000000000..0d3636686d53 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolResourceInfo.cs @@ -0,0 +1,179 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Big Data pool + /// + /// + /// A Big Data pool + /// + [Rest.Serialization.JsonTransformation] + public partial class BigDataPoolResourceInfo : TrackedResource + { + /// + /// Initializes a new instance of the BigDataPoolResourceInfo class. + /// + public BigDataPoolResourceInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BigDataPoolResourceInfo 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// The state of the Big Data + /// pool. + /// Auto-scaling properties + /// The time when the Big Data pool was + /// created. + /// Auto-pausing properties + /// The Spark events folder + /// The number of nodes in the Big Data + /// pool. + /// Library version + /// requirements + /// The Apache Spark version. + /// The default folder where Spark + /// logs will be written. + /// The level of compute power that each node in + /// the Big Data pool has. Possible values include: 'None', 'Small', + /// 'Medium', 'Large' + /// The kind of nodes that the Big Data + /// pool provides. Possible values include: 'None', + /// 'MemoryOptimized' + public BigDataPoolResourceInfo(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), AutoScaleProperties autoScale = default(AutoScaleProperties), System.DateTime? creationDate = default(System.DateTime?), AutoPauseProperties autoPause = default(AutoPauseProperties), string sparkEventsFolder = default(string), int? nodeCount = default(int?), LibraryRequirements libraryRequirements = default(LibraryRequirements), string sparkVersion = default(string), string defaultSparkLogFolder = default(string), string nodeSize = default(string), string nodeSizeFamily = default(string)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + AutoScale = autoScale; + CreationDate = creationDate; + AutoPause = autoPause; + SparkEventsFolder = sparkEventsFolder; + NodeCount = nodeCount; + LibraryRequirements = libraryRequirements; + SparkVersion = sparkVersion; + DefaultSparkLogFolder = defaultSparkLogFolder; + NodeSize = nodeSize; + NodeSizeFamily = nodeSizeFamily; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the Big Data pool. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets auto-scaling properties + /// + [JsonProperty(PropertyName = "properties.autoScale")] + public AutoScaleProperties AutoScale { get; set; } + + /// + /// Gets or sets the time when the Big Data pool was created. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; set; } + + /// + /// Gets or sets auto-pausing properties + /// + [JsonProperty(PropertyName = "properties.autoPause")] + public AutoPauseProperties AutoPause { get; set; } + + /// + /// Gets or sets the Spark events folder + /// + [JsonProperty(PropertyName = "properties.sparkEventsFolder")] + public string SparkEventsFolder { get; set; } + + /// + /// Gets or sets the number of nodes in the Big Data pool. + /// + [JsonProperty(PropertyName = "properties.nodeCount")] + public int? NodeCount { get; set; } + + /// + /// Gets or sets library version requirements + /// + [JsonProperty(PropertyName = "properties.libraryRequirements")] + public LibraryRequirements LibraryRequirements { get; set; } + + /// + /// Gets or sets the Apache Spark version. + /// + [JsonProperty(PropertyName = "properties.sparkVersion")] + public string SparkVersion { get; set; } + + /// + /// Gets or sets the default folder where Spark logs will be written. + /// + [JsonProperty(PropertyName = "properties.defaultSparkLogFolder")] + public string DefaultSparkLogFolder { get; set; } + + /// + /// Gets or sets the level of compute power that each node in the Big + /// Data pool has. Possible values include: 'None', 'Small', 'Medium', + /// 'Large' + /// + [JsonProperty(PropertyName = "properties.nodeSize")] + public string NodeSize { get; set; } + + /// + /// Gets or sets the kind of nodes that the Big Data pool provides. + /// Possible values include: 'None', 'MemoryOptimized' + /// + [JsonProperty(PropertyName = "properties.nodeSizeFamily")] + public string NodeSizeFamily { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (NodeCount > 200) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "NodeCount", 200); + } + if (NodeCount < 3) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "NodeCount", 3); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolResourceInfoListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolResourceInfoListResult.cs new file mode 100644 index 000000000000..cdb42bd6487b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BigDataPoolResourceInfoListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Collection of Big Data pools + /// + /// + /// Collection of Big Data pool information + /// + public partial class BigDataPoolResourceInfoListResult + { + /// + /// Initializes a new instance of the BigDataPoolResourceInfoListResult + /// class. + /// + public BigDataPoolResourceInfoListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BigDataPoolResourceInfoListResult + /// class. + /// + /// Link to the next page of results + /// List of Big Data pools + public BigDataPoolResourceInfoListResult(string nextLink = default(string), IList value = default(IList)) + { + NextLink = nextLink; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets link to the next page of results + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Gets or sets list of Big Data pools + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BlobAuditingPolicyState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BlobAuditingPolicyState.cs new file mode 100644 index 000000000000..12e185f86c05 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BlobAuditingPolicyState.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for BlobAuditingPolicyState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BlobAuditingPolicyState + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class BlobAuditingPolicyStateEnumExtension + { + internal static string ToSerializedValue(this BlobAuditingPolicyState? value) + { + return value == null ? null : ((BlobAuditingPolicyState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this BlobAuditingPolicyState value) + { + switch( value ) + { + case BlobAuditingPolicyState.Enabled: + return "Enabled"; + case BlobAuditingPolicyState.Disabled: + return "Disabled"; + } + return null; + } + + internal static BlobAuditingPolicyState? ParseBlobAuditingPolicyState(this string value) + { + switch( value ) + { + case "Enabled": + return BlobAuditingPolicyState.Enabled; + case "Disabled": + return BlobAuditingPolicyState.Disabled; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameAvailabilityRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameAvailabilityRequest.cs new file mode 100644 index 000000000000..608b962f4cbc --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameAvailabilityRequest.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Check name availability request + /// + /// + /// A request about whether a workspace name is available + /// + public partial class CheckNameAvailabilityRequest + { + /// + /// Initializes a new instance of the CheckNameAvailabilityRequest + /// class. + /// + public CheckNameAvailabilityRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityRequest + /// class. + /// + /// Workspace name + /// Type: workspace + public CheckNameAvailabilityRequest(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 workspace name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets type: workspace + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameAvailabilityResponse.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameAvailabilityResponse.cs new file mode 100644 index 000000000000..10a739443253 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameAvailabilityResponse.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Check name availability response + /// + /// + /// A response saying whether the workspace name is available + /// + public partial class CheckNameAvailabilityResponse + { + /// + /// Initializes a new instance of the CheckNameAvailabilityResponse + /// class. + /// + public CheckNameAvailabilityResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityResponse + /// class. + /// + /// Validation message + /// Whether the workspace name is + /// available + /// Reason the workspace name is or is not + /// available + /// Workspace name + public CheckNameAvailabilityResponse(string message = default(string), bool? available = default(bool?), string reason = default(string), string name = default(string)) + { + Message = message; + Available = available; + Reason = reason; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets validation message + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets whether the workspace name is available + /// + [JsonProperty(PropertyName = "available")] + public bool? Available { get; set; } + + /// + /// Gets or sets reason the workspace name is or is not available + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// Gets or sets workspace name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ColumnDataType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ColumnDataType.cs new file mode 100644 index 000000000000..fbef78d40337 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ColumnDataType.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.Synapse.Models +{ + + /// + /// Defines values for ColumnDataType. + /// + public static class ColumnDataType + { + public const string Image = "image"; + public const string Text = "text"; + public const string Uniqueidentifier = "uniqueidentifier"; + public const string Date = "date"; + public const string Time = "time"; + public const string Datetime2 = "datetime2"; + public const string Datetimeoffset = "datetimeoffset"; + public const string Tinyint = "tinyint"; + public const string Smallint = "smallint"; + public const string Int = "int"; + public const string Smalldatetime = "smalldatetime"; + public const string Real = "real"; + public const string Money = "money"; + public const string Datetime = "datetime"; + public const string Float = "float"; + public const string SqlVariant = "sql_variant"; + public const string Ntext = "ntext"; + public const string Bit = "bit"; + public const string Decimal = "decimal"; + public const string Numeric = "numeric"; + public const string Smallmoney = "smallmoney"; + public const string Bigint = "bigint"; + public const string Hierarchyid = "hierarchyid"; + public const string Geometry = "geometry"; + public const string Geography = "geography"; + public const string Varbinary = "varbinary"; + public const string Varchar = "varchar"; + public const string Binary = "binary"; + public const string Char = "char"; + public const string Timestamp = "timestamp"; + public const string Nvarchar = "nvarchar"; + public const string Nchar = "nchar"; + public const string Xml = "xml"; + public const string Sysname = "sysname"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreateSqlPoolRestorePointDefinition.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreateSqlPoolRestorePointDefinition.cs new file mode 100644 index 000000000000..7daef5ae807c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreateSqlPoolRestorePointDefinition.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.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the information necessary to perform a create Sql pool restore + /// point operation. + /// + public partial class CreateSqlPoolRestorePointDefinition + { + /// + /// Initializes a new instance of the + /// CreateSqlPoolRestorePointDefinition class. + /// + public CreateSqlPoolRestorePointDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CreateSqlPoolRestorePointDefinition class. + /// + /// The restore point label to + /// apply + public CreateSqlPoolRestorePointDefinition(string restorePointLabel) + { + RestorePointLabel = restorePointLabel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the restore point label to apply + /// + [JsonProperty(PropertyName = "restorePointLabel")] + public string RestorePointLabel { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RestorePointLabel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RestorePointLabel"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataLakeStorageAccountDetails.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataLakeStorageAccountDetails.cs new file mode 100644 index 000000000000..f2752dafa55a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataLakeStorageAccountDetails.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details of the data lake storage account associated with the workspace + /// + public partial class DataLakeStorageAccountDetails + { + /// + /// Initializes a new instance of the DataLakeStorageAccountDetails + /// class. + /// + public DataLakeStorageAccountDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataLakeStorageAccountDetails + /// class. + /// + /// Account URL + /// Filesystem name + public DataLakeStorageAccountDetails(string accountUrl = default(string), string filesystem = default(string)) + { + AccountUrl = accountUrl; + Filesystem = filesystem; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets account URL + /// + [JsonProperty(PropertyName = "accountUrl")] + public string AccountUrl { get; set; } + + /// + /// Gets or sets filesystem name + /// + [JsonProperty(PropertyName = "filesystem")] + public string Filesystem { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataWarehouseUserActivities.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataWarehouseUserActivities.cs new file mode 100644 index 000000000000..245ec84b00f6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataWarehouseUserActivities.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// User activities of a data warehouse + /// + [Rest.Serialization.JsonTransformation] + public partial class DataWarehouseUserActivities : ProxyResource + { + /// + /// Initializes a new instance of the DataWarehouseUserActivities + /// class. + /// + public DataWarehouseUserActivities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataWarehouseUserActivities + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Count of running and suspended + /// queries. + public DataWarehouseUserActivities(string id = default(string), string name = default(string), string type = default(string), int? activeQueriesCount = default(int?)) + : base(id, name, type) + { + ActiveQueriesCount = activeQueriesCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets count of running and suspended queries. + /// + [JsonProperty(PropertyName = "properties.activeQueriesCount")] + public int? ActiveQueriesCount { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..e6336ec6214d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorContract.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorContract.cs new file mode 100644 index 000000000000..8bc001a77f8e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorContract.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details. + /// + /// + /// Contains details when the response code indicates an error. + /// + public partial class ErrorContract + { + /// + /// Initializes a new instance of the ErrorContract class. + /// + public ErrorContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorContract class. + /// + /// The error details. + public ErrorContract(ErrorResponse error = default(ErrorResponse)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error details. + /// + [JsonProperty(PropertyName = "error")] + public ErrorResponse Error { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorContractException.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorContractException.cs new file mode 100644 index 000000000000..3e834982c41c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorContractException.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.Synapse.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorContract + /// information. + /// + public partial class ErrorContractException : 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 ErrorContract Body { get; set; } + + /// + /// Initializes a new instance of the ErrorContractException class. + /// + public ErrorContractException() + { + } + + /// + /// Initializes a new instance of the ErrorContractException class. + /// + /// The exception message. + public ErrorContractException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorContractException class. + /// + /// The exception message. + /// Inner exception. + public ErrorContractException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorDetail.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..3e096daa8efc --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// Error message + /// Error code + /// Error target + public ErrorDetail(string message = default(string), string code = default(string), string target = default(string)) + { + Message = message; + Code = code; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error message + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets error code + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error target + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorResponse.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..2a6be76989a0 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ErrorResponse.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource management error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/GeoBackupPolicy.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/GeoBackupPolicy.cs new file mode 100644 index 000000000000..de471617488a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/GeoBackupPolicy.cs @@ -0,0 +1,99 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A database geo backup policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class GeoBackupPolicy : ProxyResource + { + /// + /// Initializes a new instance of the GeoBackupPolicy class. + /// + public GeoBackupPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoBackupPolicy class. + /// + /// The state of the geo backup policy. Possible + /// values include: 'Disabled', 'Enabled' + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The storage type of the geo backup + /// policy. + /// Kind of geo backup policy. This is metadata + /// used for the Azure portal experience. + /// Backup policy location. + public GeoBackupPolicy(GeoBackupPolicyState state, string id = default(string), string name = default(string), string type = default(string), string storageType = default(string), string kind = default(string), string location = default(string)) + : base(id, name, type) + { + State = state; + StorageType = storageType; + Kind = kind; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of the geo backup policy. Possible values + /// include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public GeoBackupPolicyState State { get; set; } + + /// + /// Gets the storage type of the geo backup policy. + /// + [JsonProperty(PropertyName = "properties.storageType")] + public string StorageType { get; private set; } + + /// + /// Gets kind of geo backup policy. This is metadata used for the + /// Azure portal experience. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets backup policy location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/GeoBackupPolicyState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/GeoBackupPolicyState.cs new file mode 100644 index 000000000000..59a0e13ae5a2 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/GeoBackupPolicyState.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for GeoBackupPolicyState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum GeoBackupPolicyState + { + [EnumMember(Value = "Disabled")] + Disabled, + [EnumMember(Value = "Enabled")] + Enabled + } + internal static class GeoBackupPolicyStateEnumExtension + { + internal static string ToSerializedValue(this GeoBackupPolicyState? value) + { + return value == null ? null : ((GeoBackupPolicyState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this GeoBackupPolicyState value) + { + switch( value ) + { + case GeoBackupPolicyState.Disabled: + return "Disabled"; + case GeoBackupPolicyState.Enabled: + return "Enabled"; + } + return null; + } + + internal static GeoBackupPolicyState? ParseGeoBackupPolicyState(this string value) + { + switch( value ) + { + case "Disabled": + return GeoBackupPolicyState.Disabled; + case "Enabled": + return GeoBackupPolicyState.Enabled; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfo.cs new file mode 100644 index 000000000000..adf00a6eec0a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfo.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// IP firewall rule + /// + [Rest.Serialization.JsonTransformation] + public partial class IpFirewallRuleInfo : ProxyResource + { + /// + /// Initializes a new instance of the IpFirewallRuleInfo class. + /// + public IpFirewallRuleInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpFirewallRuleInfo 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The end IP address of the firewall rule. + /// Must be IPv4 format. Must be greater than or equal to + /// startIpAddress + /// Resource provisioning state. + /// Possible values include: 'Provisioning', 'Succeeded', 'Deleting', + /// 'Failed', 'DeleteError' + /// The start IP address of the firewall + /// rule. Must be IPv4 format + public IpFirewallRuleInfo(string id = default(string), string name = default(string), string type = default(string), string endIpAddress = default(string), string provisioningState = default(string), string startIpAddress = default(string)) + : base(id, name, type) + { + EndIpAddress = endIpAddress; + ProvisioningState = provisioningState; + StartIpAddress = startIpAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the end IP address of the firewall rule. Must be IPv4 + /// format. Must be greater than or equal to startIpAddress + /// + [JsonProperty(PropertyName = "properties.endIpAddress")] + public string EndIpAddress { get; set; } + + /// + /// Gets resource provisioning state. Possible values include: + /// 'Provisioning', 'Succeeded', 'Deleting', 'Failed', 'DeleteError' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the start IP address of the firewall rule. Must be + /// IPv4 format + /// + [JsonProperty(PropertyName = "properties.startIpAddress")] + public string StartIpAddress { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfoListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfoListResult.cs new file mode 100644 index 000000000000..0c6d5cef1601 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfoListResult.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of IP firewall rules + /// + public partial class IpFirewallRuleInfoListResult + { + /// + /// Initializes a new instance of the IpFirewallRuleInfoListResult + /// class. + /// + public IpFirewallRuleInfoListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpFirewallRuleInfoListResult + /// class. + /// + /// Link to next page of results + /// List of IP firewall rules + public IpFirewallRuleInfoListResult(string nextLink = default(string), IList value = default(IList)) + { + NextLink = nextLink; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets link to next page of results + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Gets or sets list of IP firewall rules + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleProperties.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleProperties.cs new file mode 100644 index 000000000000..81ce44d5ddb6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleProperties.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// IP firewall rule properties + /// + public partial class IpFirewallRuleProperties + { + /// + /// Initializes a new instance of the IpFirewallRuleProperties class. + /// + public IpFirewallRuleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpFirewallRuleProperties class. + /// + /// The end IP address of the firewall rule. + /// Must be IPv4 format. Must be greater than or equal to + /// startIpAddress + /// Resource provisioning state. + /// Possible values include: 'Provisioning', 'Succeeded', 'Deleting', + /// 'Failed', 'DeleteError' + /// The start IP address of the firewall + /// rule. Must be IPv4 format + public IpFirewallRuleProperties(string endIpAddress = default(string), string provisioningState = default(string), string startIpAddress = default(string)) + { + EndIpAddress = endIpAddress; + ProvisioningState = provisioningState; + StartIpAddress = startIpAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the end IP address of the firewall rule. Must be IPv4 + /// format. Must be greater than or equal to startIpAddress + /// + [JsonProperty(PropertyName = "endIpAddress")] + public string EndIpAddress { get; set; } + + /// + /// Gets resource provisioning state. Possible values include: + /// 'Provisioning', 'Succeeded', 'Deleting', 'Failed', 'DeleteError' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the start IP address of the firewall rule. Must be + /// IPv4 format + /// + [JsonProperty(PropertyName = "startIpAddress")] + public string StartIpAddress { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LibraryRequirements.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LibraryRequirements.cs new file mode 100644 index 000000000000..7040771ec72b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LibraryRequirements.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Spark pool library version requirements + /// + /// + /// Library requirements for a Big Data pool powered by Apache Spark + /// + public partial class LibraryRequirements + { + /// + /// Initializes a new instance of the LibraryRequirements class. + /// + public LibraryRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LibraryRequirements class. + /// + /// The last update time of the library requirements + /// file. + /// The library requirements. + /// The filename of the library requirements + /// file. + public LibraryRequirements(System.DateTime? time = default(System.DateTime?), string content = default(string), string filename = default(string)) + { + Time = time; + Content = content; + Filename = filename; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the last update time of the library requirements file. + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; private set; } + + /// + /// Gets or sets the library requirements. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + /// + /// Gets or sets the filename of the library requirements file. + /// + [JsonProperty(PropertyName = "filename")] + public string Filename { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentity.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentity.cs new file mode 100644 index 000000000000..b0f39d1579f9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentity.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The workspace managed identity + /// + public partial class ManagedIdentity + { + /// + /// Initializes a new instance of the ManagedIdentity class. + /// + public ManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedIdentity class. + /// + /// The principal ID of the workspace managed + /// identity + /// The tenant ID of the workspace managed + /// identity + /// The type of managed identity for the workspace. + /// Possible values include: 'None', 'SystemAssigned' + public ManagedIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of the workspace managed identity + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of the workspace managed identity + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the type of managed identity for the workspace. + /// Possible values include: 'None', 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentitySqlControlSettingsModel.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentitySqlControlSettingsModel.cs new file mode 100644 index 000000000000..0fd032c7f814 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentitySqlControlSettingsModel.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed Identity Sql Control Settings + /// + /// + /// Sql Control Settings for workspace managed identity + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedIdentitySqlControlSettingsModel : ProxyResource + { + /// + /// Initializes a new instance of the + /// ManagedIdentitySqlControlSettingsModel class. + /// + public ManagedIdentitySqlControlSettingsModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedIdentitySqlControlSettingsModel 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Grant sql control to + /// managed identity + public ManagedIdentitySqlControlSettingsModel(string id = default(string), string name = default(string), string type = default(string), ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity grantSqlControlToManagedIdentity = default(ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity)) + : base(id, name, type) + { + GrantSqlControlToManagedIdentity = grantSqlControlToManagedIdentity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets grant sql control to managed identity + /// + [JsonProperty(PropertyName = "properties.grantSqlControlToManagedIdentity")] + public ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity GrantSqlControlToManagedIdentity { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity.cs new file mode 100644 index 000000000000..4a00fc766b25 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Grant sql control to managed identity + /// + public partial class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity + { + /// + /// Initializes a new instance of the + /// ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity + /// class. + /// + public ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity + /// class. + /// + /// Desired state. Possible values include: + /// 'Enabled', 'Disabled' + /// Actual state. Possible values include: + /// 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Unknown' + public ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity(string desiredState = default(string), string actualState = default(string)) + { + DesiredState = desiredState; + ActualState = actualState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired state. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "desiredState")] + public string DesiredState { get; set; } + + /// + /// Gets actual state. Possible values include: 'Enabling', 'Enabled', + /// 'Disabling', 'Disabled', 'Unknown' + /// + [JsonProperty(PropertyName = "actualState")] + public string ActualState { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagementOperationState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagementOperationState.cs new file mode 100644 index 000000000000..8049427dfe67 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ManagementOperationState.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.Synapse.Models +{ + + /// + /// Defines values for ManagementOperationState. + /// + public static class ManagementOperationState + { + public const string Pending = "Pending"; + public const string InProgress = "InProgress"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string CancelInProgress = "CancelInProgress"; + public const string Cancelled = "Cancelled"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/MetadataSyncConfig.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/MetadataSyncConfig.cs new file mode 100644 index 000000000000..ca95383209bb --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/MetadataSyncConfig.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata sync configuration + /// + /// + /// Configuration for metadata sync + /// + [Rest.Serialization.JsonTransformation] + public partial class MetadataSyncConfig : ProxyResource + { + /// + /// Initializes a new instance of the MetadataSyncConfig class. + /// + public MetadataSyncConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataSyncConfig 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Indicates whether the metadata sync is + /// enabled or disabled + public MetadataSyncConfig(string id = default(string), string name = default(string), string type = default(string), bool? enabled = default(bool?)) + : base(id, name, type) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the metadata sync is enabled or + /// disabled + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/NodeSize.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/NodeSize.cs new file mode 100644 index 000000000000..33ef9af26ad0 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/NodeSize.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.Synapse.Models +{ + + /// + /// Defines values for NodeSize. + /// + public static class NodeSize + { + public const string None = "None"; + public const string Small = "Small"; + public const string Medium = "Medium"; + public const string Large = "Large"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/NodeSizeFamily.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/NodeSizeFamily.cs new file mode 100644 index 000000000000..c7b2597409ea --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/NodeSizeFamily.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.Synapse.Models +{ + + /// + /// Defines values for NodeSizeFamily. + /// + public static class NodeSizeFamily + { + public const string None = "None"; + public const string MemoryOptimized = "MemoryOptimized"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaLogSpecification.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaLogSpecification.cs new file mode 100644 index 000000000000..1dda8eba8ee0 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaLogSpecification.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// What is this? + /// + public partial class OperationMetaLogSpecification + { + /// + /// Initializes a new instance of the OperationMetaLogSpecification + /// class. + /// + public OperationMetaLogSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationMetaLogSpecification + /// class. + /// + /// Log display name + /// Time range the log covers + /// Log unique name + public OperationMetaLogSpecification(string displayName = default(string), string blobDuration = default(string), string name = default(string)) + { + DisplayName = displayName; + BlobDuration = blobDuration; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets log display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets time range the log covers + /// + [JsonProperty(PropertyName = "blobDuration")] + public string BlobDuration { get; set; } + + /// + /// Gets or sets log unique name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaMetricDimensionSpecification.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaMetricDimensionSpecification.cs new file mode 100644 index 000000000000..b74a480e830e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaMetricDimensionSpecification.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// What is this? + /// + public partial class OperationMetaMetricDimensionSpecification + { + /// + /// Initializes a new instance of the + /// OperationMetaMetricDimensionSpecification class. + /// + public OperationMetaMetricDimensionSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OperationMetaMetricDimensionSpecification class. + /// + /// Dimension display name + /// Dimension unique name + /// Whether this metric should be + /// exported for Shoebox + public OperationMetaMetricDimensionSpecification(string displayName = default(string), string name = default(string), bool? toBeExportedForShoebox = default(bool?)) + { + DisplayName = displayName; + Name = name; + ToBeExportedForShoebox = toBeExportedForShoebox; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets dimension display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets dimension unique name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets whether this metric should be exported for Shoebox + /// + [JsonProperty(PropertyName = "toBeExportedForShoebox")] + public bool? ToBeExportedForShoebox { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaMetricSpecification.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaMetricSpecification.cs new file mode 100644 index 000000000000..53572ca17d5a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaMetricSpecification.cs @@ -0,0 +1,137 @@ +// +// 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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// What is this? + /// + public partial class OperationMetaMetricSpecification + { + /// + /// Initializes a new instance of the OperationMetaMetricSpecification + /// class. + /// + public OperationMetaMetricSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationMetaMetricSpecification + /// class. + /// + /// The source MDM namespace + /// Metric display name + /// Metric unique name + /// Metric aggregation type + /// Metric description + /// The source MDM account + /// Whether the regional MDM + /// account is enabled + /// Metric units + /// Metric dimensions + /// Whether the metric + /// supports instance-level aggregation + /// Metric filter + public OperationMetaMetricSpecification(string sourceMdmNamespace = default(string), string displayName = default(string), string name = default(string), string aggregationType = default(string), string displayDescription = default(string), string sourceMdmAccount = default(string), bool? enableRegionalMdmAccount = default(bool?), string unit = default(string), IList dimensions = default(IList), bool? supportsInstanceLevelAggregation = default(bool?), string metricFilterPattern = default(string)) + { + SourceMdmNamespace = sourceMdmNamespace; + DisplayName = displayName; + Name = name; + AggregationType = aggregationType; + DisplayDescription = displayDescription; + SourceMdmAccount = sourceMdmAccount; + EnableRegionalMdmAccount = enableRegionalMdmAccount; + Unit = unit; + Dimensions = dimensions; + SupportsInstanceLevelAggregation = supportsInstanceLevelAggregation; + MetricFilterPattern = metricFilterPattern; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source MDM namespace + /// + [JsonProperty(PropertyName = "sourceMdmNamespace")] + public string SourceMdmNamespace { get; set; } + + /// + /// Gets or sets metric display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets metric unique name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets metric aggregation type + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; set; } + + /// + /// Gets or sets metric description + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; set; } + + /// + /// Gets or sets the source MDM account + /// + [JsonProperty(PropertyName = "sourceMdmAccount")] + public string SourceMdmAccount { get; set; } + + /// + /// Gets or sets whether the regional MDM account is enabled + /// + [JsonProperty(PropertyName = "enableRegionalMdmAccount")] + public bool? EnableRegionalMdmAccount { get; set; } + + /// + /// Gets or sets metric units + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets metric dimensions + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets whether the metric supports instance-level aggregation + /// + [JsonProperty(PropertyName = "supportsInstanceLevelAggregation")] + public bool? SupportsInstanceLevelAggregation { get; set; } + + /// + /// Gets or sets metric filter + /// + [JsonProperty(PropertyName = "metricFilterPattern")] + public string MetricFilterPattern { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaServiceSpecification.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaServiceSpecification.cs new file mode 100644 index 000000000000..a72860768def --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationMetaServiceSpecification.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// What is this? + /// + public partial class OperationMetaServiceSpecification + { + /// + /// Initializes a new instance of the OperationMetaServiceSpecification + /// class. + /// + public OperationMetaServiceSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationMetaServiceSpecification + /// class. + /// + /// Service metric + /// specifications + /// Service log specifications + public OperationMetaServiceSpecification(IList metricSpecifications = default(IList), IList logSpecifications = default(IList)) + { + MetricSpecifications = metricSpecifications; + LogSpecifications = logSpecifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service metric specifications + /// + [JsonProperty(PropertyName = "metricSpecifications")] + public IList MetricSpecifications { get; set; } + + /// + /// Gets or sets service log specifications + /// + [JsonProperty(PropertyName = "logSpecifications")] + public IList LogSpecifications { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationResource.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationResource.cs new file mode 100644 index 000000000000..d29748425941 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationResource.cs @@ -0,0 +1,110 @@ +// +// 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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An operation + /// + public partial class OperationResource + { + /// + /// Initializes a new instance of the OperationResource class. + /// + public OperationResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResource class. + /// + /// Operation ID + /// Operation name + /// Operation status. Possible values include: + /// 'InProgress', 'Succeeded', 'Failed', 'Canceled' + /// Operation properties + /// Errors from the operation + /// Operation start time + /// Operation start time + /// Completion percentage of the + /// operation + public OperationResource(string id = default(string), string name = default(string), string status = default(string), object properties = default(object), ErrorDetail error = default(ErrorDetail), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), double? percentComplete = default(double?)) + { + Id = id; + Name = name; + Status = status; + Properties = properties; + Error = error; + StartTime = startTime; + EndTime = endTime; + PercentComplete = percentComplete; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation ID + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets operation name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets operation status. Possible values include: + /// 'InProgress', 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets operation properties + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + /// + /// Gets or sets errors from the operation + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + /// + /// Gets or sets operation start time + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets operation start time + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets completion percentage of the operation + /// + [JsonProperty(PropertyName = "percentComplete")] + public double? PercentComplete { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationStatus.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationStatus.cs new file mode 100644 index 000000000000..ae294eec4d65 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationStatus.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.Synapse.Models +{ + + /// + /// Defines values for OperationStatus. + /// + public static class OperationStatus + { + public const string InProgress = "InProgress"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ProvisioningState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..431f29e95b5e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ProvisioningState.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.Synapse.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Provisioning = "Provisioning"; + public const string Succeeded = "Succeeded"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + public const string DeleteError = "DeleteError"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ProxyResource.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..e68fa8f2b041 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,50 @@ +// +// 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.Synapse.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags + /// + 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryAggregationFunction.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryAggregationFunction.cs new file mode 100644 index 000000000000..23123eb32d38 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryAggregationFunction.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for QueryAggregationFunction. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum QueryAggregationFunction + { + [EnumMember(Value = "min")] + Min, + [EnumMember(Value = "max")] + Max, + [EnumMember(Value = "avg")] + Avg, + [EnumMember(Value = "sum")] + Sum + } + internal static class QueryAggregationFunctionEnumExtension + { + internal static string ToSerializedValue(this QueryAggregationFunction? value) + { + return value == null ? null : ((QueryAggregationFunction)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this QueryAggregationFunction value) + { + switch( value ) + { + case QueryAggregationFunction.Min: + return "min"; + case QueryAggregationFunction.Max: + return "max"; + case QueryAggregationFunction.Avg: + return "avg"; + case QueryAggregationFunction.Sum: + return "sum"; + } + return null; + } + + internal static QueryAggregationFunction? ParseQueryAggregationFunction(this string value) + { + switch( value ) + { + case "min": + return QueryAggregationFunction.Min; + case "max": + return QueryAggregationFunction.Max; + case "avg": + return QueryAggregationFunction.Avg; + case "sum": + return QueryAggregationFunction.Sum; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryExecutionType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryExecutionType.cs new file mode 100644 index 000000000000..c1f7a195e87b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryExecutionType.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for QueryExecutionType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum QueryExecutionType + { + [EnumMember(Value = "any")] + Any, + [EnumMember(Value = "regular")] + Regular, + [EnumMember(Value = "irregular")] + Irregular, + [EnumMember(Value = "aborted")] + Aborted, + [EnumMember(Value = "exception")] + Exception + } + internal static class QueryExecutionTypeEnumExtension + { + internal static string ToSerializedValue(this QueryExecutionType? value) + { + return value == null ? null : ((QueryExecutionType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this QueryExecutionType value) + { + switch( value ) + { + case QueryExecutionType.Any: + return "any"; + case QueryExecutionType.Regular: + return "regular"; + case QueryExecutionType.Irregular: + return "irregular"; + case QueryExecutionType.Aborted: + return "aborted"; + case QueryExecutionType.Exception: + return "exception"; + } + return null; + } + + internal static QueryExecutionType? ParseQueryExecutionType(this string value) + { + switch( value ) + { + case "any": + return QueryExecutionType.Any; + case "regular": + return QueryExecutionType.Regular; + case "irregular": + return QueryExecutionType.Irregular; + case "aborted": + return QueryExecutionType.Aborted; + case "exception": + return QueryExecutionType.Exception; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryInterval.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryInterval.cs new file mode 100644 index 000000000000..67b93cf42d71 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryInterval.cs @@ -0,0 +1,73 @@ +// +// 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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A database query. + /// + public partial class QueryInterval + { + /// + /// Initializes a new instance of the QueryInterval class. + /// + public QueryInterval() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryInterval class. + /// + /// The start time of the measurement + /// interval (ISO8601 format). + /// The number of times the query was + /// executed during this interval. + /// The list of query metrics during this + /// interval. + public QueryInterval(System.DateTime? intervalStartTime = default(System.DateTime?), double? executionCount = default(double?), IList metrics = default(IList)) + { + IntervalStartTime = intervalStartTime; + ExecutionCount = executionCount; + Metrics = metrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the start time of the measurement interval (ISO8601 format). + /// + [JsonProperty(PropertyName = "intervalStartTime")] + public System.DateTime? IntervalStartTime { get; private set; } + + /// + /// Gets the number of times the query was executed during this + /// interval. + /// + [JsonProperty(PropertyName = "executionCount")] + public double? ExecutionCount { get; private set; } + + /// + /// Gets the list of query metrics during this interval. + /// + [JsonProperty(PropertyName = "metrics")] + public IList Metrics { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryMetric.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryMetric.cs new file mode 100644 index 000000000000..11e92f38fbde --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryMetric.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A database query. + /// + public partial class QueryMetric + { + /// + /// Initializes a new instance of the QueryMetric class. + /// + public QueryMetric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryMetric class. + /// + /// The name of the metric + /// The name of the metric for display in + /// user interface + /// The unit of measurement. Possible values + /// include: 'percentage', 'KB', 'microseconds' + /// The measured value + public QueryMetric(string name = default(string), string displayName = default(string), QueryMetricUnit? unit = default(QueryMetricUnit?), double? value = default(double?)) + { + Name = name; + DisplayName = displayName; + Unit = unit; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the metric + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the name of the metric for display in user interface + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the unit of measurement. Possible values include: + /// 'percentage', 'KB', 'microseconds' + /// + [JsonProperty(PropertyName = "unit")] + public QueryMetricUnit? Unit { get; private set; } + + /// + /// Gets the measured value + /// + [JsonProperty(PropertyName = "value")] + public double? Value { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryMetricUnit.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryMetricUnit.cs new file mode 100644 index 000000000000..5414b2576aba --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryMetricUnit.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for QueryMetricUnit. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum QueryMetricUnit + { + [EnumMember(Value = "percentage")] + Percentage, + [EnumMember(Value = "KB")] + KB, + [EnumMember(Value = "microseconds")] + Microseconds + } + internal static class QueryMetricUnitEnumExtension + { + internal static string ToSerializedValue(this QueryMetricUnit? value) + { + return value == null ? null : ((QueryMetricUnit)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this QueryMetricUnit value) + { + switch( value ) + { + case QueryMetricUnit.Percentage: + return "percentage"; + case QueryMetricUnit.KB: + return "KB"; + case QueryMetricUnit.Microseconds: + return "microseconds"; + } + return null; + } + + internal static QueryMetricUnit? ParseQueryMetricUnit(this string value) + { + switch( value ) + { + case "percentage": + return QueryMetricUnit.Percentage; + case "KB": + return QueryMetricUnit.KB; + case "microseconds": + return QueryMetricUnit.Microseconds; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryObservedMetricType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryObservedMetricType.cs new file mode 100644 index 000000000000..7cd8352ec582 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryObservedMetricType.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for QueryObservedMetricType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum QueryObservedMetricType + { + [EnumMember(Value = "cpu")] + Cpu, + [EnumMember(Value = "io")] + Io, + [EnumMember(Value = "logio")] + Logio, + [EnumMember(Value = "duration")] + Duration, + [EnumMember(Value = "executionCount")] + ExecutionCount + } + internal static class QueryObservedMetricTypeEnumExtension + { + internal static string ToSerializedValue(this QueryObservedMetricType? value) + { + return value == null ? null : ((QueryObservedMetricType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this QueryObservedMetricType value) + { + switch( value ) + { + case QueryObservedMetricType.Cpu: + return "cpu"; + case QueryObservedMetricType.Io: + return "io"; + case QueryObservedMetricType.Logio: + return "logio"; + case QueryObservedMetricType.Duration: + return "duration"; + case QueryObservedMetricType.ExecutionCount: + return "executionCount"; + } + return null; + } + + internal static QueryObservedMetricType? ParseQueryObservedMetricType(this string value) + { + switch( value ) + { + case "cpu": + return QueryObservedMetricType.Cpu; + case "io": + return QueryObservedMetricType.Io; + case "logio": + return QueryObservedMetricType.Logio; + case "duration": + return QueryObservedMetricType.Duration; + case "executionCount": + return QueryObservedMetricType.ExecutionCount; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryStatistic.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryStatistic.cs new file mode 100644 index 000000000000..af706a1ff9b8 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/QueryStatistic.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A database query. + /// + public partial class QueryStatistic + { + /// + /// Initializes a new instance of the QueryStatistic class. + /// + public QueryStatistic() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryStatistic class. + /// + /// The id of the query + /// The list of query intervals. + public QueryStatistic(string queryId = default(string), IList intervals = default(IList)) + { + QueryId = queryId; + Intervals = intervals; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of the query + /// + [JsonProperty(PropertyName = "queryId")] + public string QueryId { get; private set; } + + /// + /// Gets the list of query intervals. + /// + [JsonProperty(PropertyName = "intervals")] + public IList Intervals { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplaceAllFirewallRulesOperationResponse.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplaceAllFirewallRulesOperationResponse.cs new file mode 100644 index 000000000000..b144721661f1 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplaceAllFirewallRulesOperationResponse.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An existing operation for replacing the firewall rules + /// + public partial class ReplaceAllFirewallRulesOperationResponse + { + /// + /// Initializes a new instance of the + /// ReplaceAllFirewallRulesOperationResponse class. + /// + public ReplaceAllFirewallRulesOperationResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReplaceAllFirewallRulesOperationResponse class. + /// + /// The operation ID + public ReplaceAllFirewallRulesOperationResponse(string operationId = default(string)) + { + OperationId = operationId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operation ID + /// + [JsonProperty(PropertyName = "operationId")] + public string OperationId { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplaceAllIpFirewallRulesRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplaceAllIpFirewallRulesRequest.cs new file mode 100644 index 000000000000..922403e0bcd4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplaceAllIpFirewallRulesRequest.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Replace all IP firewall rules request + /// + public partial class ReplaceAllIpFirewallRulesRequest + { + /// + /// Initializes a new instance of the ReplaceAllIpFirewallRulesRequest + /// class. + /// + public ReplaceAllIpFirewallRulesRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplaceAllIpFirewallRulesRequest + /// class. + /// + /// IP firewall rule properties + public ReplaceAllIpFirewallRulesRequest(IDictionary ipFirewallRules = default(IDictionary)) + { + IpFirewallRules = ipFirewallRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets IP firewall rule properties + /// + [JsonProperty(PropertyName = "ipFirewallRules")] + public IDictionary IpFirewallRules { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationLink.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationLink.cs new file mode 100644 index 000000000000..67144c4d0fc1 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationLink.cs @@ -0,0 +1,161 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a Sql pool replication link. + /// + [Rest.Serialization.JsonTransformation] + public partial class ReplicationLink : ProxyResource + { + /// + /// Initializes a new instance of the ReplicationLink class. + /// + public ReplicationLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplicationLink 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Location of the workspace that contains this + /// firewall rule. + /// Legacy value indicating whether + /// termination is allowed. Currently always returns true. + /// Replication mode of this replication + /// link. + /// The name of the workspace hosting the + /// partner Sql pool. + /// The name of the partner Sql + /// pool. + /// The Azure Region of the partner Sql + /// pool. + /// The role of the Sql pool in the replication + /// link. Possible values include: 'Primary', 'Secondary', + /// 'NonReadableSecondary', 'Source', 'Copy' + /// The role of the partner Sql pool in the + /// replication link. Possible values include: 'Primary', 'Secondary', + /// 'NonReadableSecondary', 'Source', 'Copy' + /// The start time for the replication + /// link. + /// The percentage of seeding complete + /// for the replication link. + /// The replication state for the + /// replication link. Possible values include: 'PENDING', 'SEEDING', + /// 'CATCH_UP', 'SUSPENDED' + public ReplicationLink(string id = default(string), string name = default(string), string type = default(string), string location = default(string), bool? isTerminationAllowed = default(bool?), string replicationMode = default(string), string partnerServer = default(string), string partnerDatabase = default(string), string partnerLocation = default(string), ReplicationRole? role = default(ReplicationRole?), ReplicationRole? partnerRole = default(ReplicationRole?), System.DateTime? startTime = default(System.DateTime?), int? percentComplete = default(int?), string replicationState = default(string)) + : base(id, name, type) + { + Location = location; + IsTerminationAllowed = isTerminationAllowed; + ReplicationMode = replicationMode; + PartnerServer = partnerServer; + PartnerDatabase = partnerDatabase; + PartnerLocation = partnerLocation; + Role = role; + PartnerRole = partnerRole; + StartTime = startTime; + PercentComplete = percentComplete; + ReplicationState = replicationState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the workspace that contains this firewall rule. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets legacy value indicating whether termination is allowed. + /// Currently always returns true. + /// + [JsonProperty(PropertyName = "properties.isTerminationAllowed")] + public bool? IsTerminationAllowed { get; private set; } + + /// + /// Gets replication mode of this replication link. + /// + [JsonProperty(PropertyName = "properties.replicationMode")] + public string ReplicationMode { get; private set; } + + /// + /// Gets the name of the workspace hosting the partner Sql pool. + /// + [JsonProperty(PropertyName = "properties.partnerServer")] + public string PartnerServer { get; private set; } + + /// + /// Gets the name of the partner Sql pool. + /// + [JsonProperty(PropertyName = "properties.partnerDatabase")] + public string PartnerDatabase { get; private set; } + + /// + /// Gets the Azure Region of the partner Sql pool. + /// + [JsonProperty(PropertyName = "properties.partnerLocation")] + public string PartnerLocation { get; private set; } + + /// + /// Gets the role of the Sql pool in the replication link. Possible + /// values include: 'Primary', 'Secondary', 'NonReadableSecondary', + /// 'Source', 'Copy' + /// + [JsonProperty(PropertyName = "properties.role")] + public ReplicationRole? Role { get; private set; } + + /// + /// Gets the role of the partner Sql pool in the replication link. + /// Possible values include: 'Primary', 'Secondary', + /// 'NonReadableSecondary', 'Source', 'Copy' + /// + [JsonProperty(PropertyName = "properties.partnerRole")] + public ReplicationRole? PartnerRole { get; private set; } + + /// + /// Gets the start time for the replication link. + /// + [JsonProperty(PropertyName = "properties.startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the percentage of seeding complete for the replication link. + /// + [JsonProperty(PropertyName = "properties.percentComplete")] + public int? PercentComplete { get; private set; } + + /// + /// Gets the replication state for the replication link. Possible + /// values include: 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED' + /// + [JsonProperty(PropertyName = "properties.replicationState")] + public string ReplicationState { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationLinkListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationLinkListResult.cs new file mode 100644 index 000000000000..d7e9fa79bdb7 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationLinkListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents the response to a List Sql pool replication link request. + /// + public partial class ReplicationLinkListResult + { + /// + /// Initializes a new instance of the ReplicationLinkListResult class. + /// + public ReplicationLinkListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplicationLinkListResult class. + /// + /// The list of Sql pool replication links housed + /// in the Sql pool. + /// Link to retrieve next page of + /// results. + public ReplicationLinkListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of Sql pool replication links housed in the + /// Sql pool. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationRole.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationRole.cs new file mode 100644 index 000000000000..f54598457d6e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationRole.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ReplicationRole. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ReplicationRole + { + [EnumMember(Value = "Primary")] + Primary, + [EnumMember(Value = "Secondary")] + Secondary, + [EnumMember(Value = "NonReadableSecondary")] + NonReadableSecondary, + [EnumMember(Value = "Source")] + Source, + [EnumMember(Value = "Copy")] + Copy + } + internal static class ReplicationRoleEnumExtension + { + internal static string ToSerializedValue(this ReplicationRole? value) + { + return value == null ? null : ((ReplicationRole)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ReplicationRole value) + { + switch( value ) + { + case ReplicationRole.Primary: + return "Primary"; + case ReplicationRole.Secondary: + return "Secondary"; + case ReplicationRole.NonReadableSecondary: + return "NonReadableSecondary"; + case ReplicationRole.Source: + return "Source"; + case ReplicationRole.Copy: + return "Copy"; + } + return null; + } + + internal static ReplicationRole? ParseReplicationRole(this string value) + { + switch( value ) + { + case "Primary": + return ReplicationRole.Primary; + case "Secondary": + return ReplicationRole.Secondary; + case "NonReadableSecondary": + return ReplicationRole.NonReadableSecondary; + case "Source": + return ReplicationRole.Source; + case "Copy": + return ReplicationRole.Copy; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationState.cs new file mode 100644 index 000000000000..9d2515f2ef57 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReplicationState.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.Synapse.Models +{ + + /// + /// Defines values for ReplicationState. + /// + public static class ReplicationState + { + public const string PENDING = "PENDING"; + public const string SEEDING = "SEEDING"; + public const string CATCHUP = "CATCH_UP"; + public const string SUSPENDED = "SUSPENDED"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Resource.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..987bf2c55237 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Resource.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class Resource + { + /// + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceIdentityType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..95415c6aece4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceIdentityType.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "SystemAssigned")] + SystemAssigned + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.None: + return "None"; + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "None": + return ResourceIdentityType.None; + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceMoveDefinition.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceMoveDefinition.cs new file mode 100644 index 000000000000..d1f2f9f97eed --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceMoveDefinition.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.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the information necessary to perform a resource move (rename). + /// + public partial class ResourceMoveDefinition + { + /// + /// Initializes a new instance of the ResourceMoveDefinition class. + /// + public ResourceMoveDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceMoveDefinition class. + /// + /// The target ID for the resource + public ResourceMoveDefinition(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target ID for the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePoint.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePoint.cs new file mode 100644 index 000000000000..9fc4b4ceebab --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePoint.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database restore points. + /// + [Rest.Serialization.JsonTransformation] + public partial class RestorePoint : ProxyResource + { + /// + /// Initializes a new instance of the RestorePoint class. + /// + public RestorePoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePoint 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource location. + /// The type of restore point. Possible + /// values include: 'CONTINUOUS', 'DISCRETE' + /// The earliest time to which this + /// database can be restored + /// The time the backup was + /// taken + /// The label of restore point for + /// backup request by user + public RestorePoint(string id = default(string), string name = default(string), string type = default(string), string location = default(string), RestorePointType? restorePointType = default(RestorePointType?), System.DateTime? earliestRestoreDate = default(System.DateTime?), System.DateTime? restorePointCreationDate = default(System.DateTime?), string restorePointLabel = default(string)) + : base(id, name, type) + { + Location = location; + RestorePointType = restorePointType; + EarliestRestoreDate = earliestRestoreDate; + RestorePointCreationDate = restorePointCreationDate; + RestorePointLabel = restorePointLabel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets the type of restore point. Possible values include: + /// 'CONTINUOUS', 'DISCRETE' + /// + [JsonProperty(PropertyName = "properties.restorePointType")] + public RestorePointType? RestorePointType { get; private set; } + + /// + /// Gets the earliest time to which this database can be restored + /// + [JsonProperty(PropertyName = "properties.earliestRestoreDate")] + public System.DateTime? EarliestRestoreDate { get; private set; } + + /// + /// Gets the time the backup was taken + /// + [JsonProperty(PropertyName = "properties.restorePointCreationDate")] + public System.DateTime? RestorePointCreationDate { get; private set; } + + /// + /// Gets the label of restore point for backup request by user + /// + [JsonProperty(PropertyName = "properties.restorePointLabel")] + public string RestorePointLabel { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePointListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePointListResult.cs new file mode 100644 index 000000000000..5f31cd176b9a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePointListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of long term retention backups. + /// + public partial class RestorePointListResult + { + /// + /// Initializes a new instance of the RestorePointListResult class. + /// + public RestorePointListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestorePointListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public RestorePointListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePointType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePointType.cs new file mode 100644 index 000000000000..60c78549215d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/RestorePointType.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RestorePointType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RestorePointType + { + [EnumMember(Value = "CONTINUOUS")] + CONTINUOUS, + [EnumMember(Value = "DISCRETE")] + DISCRETE + } + internal static class RestorePointTypeEnumExtension + { + internal static string ToSerializedValue(this RestorePointType? value) + { + return value == null ? null : ((RestorePointType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RestorePointType value) + { + switch( value ) + { + case RestorePointType.CONTINUOUS: + return "CONTINUOUS"; + case RestorePointType.DISCRETE: + return "DISCRETE"; + } + return null; + } + + internal static RestorePointType? ParseRestorePointType(this string value) + { + switch( value ) + { + case "CONTINUOUS": + return RestorePointType.CONTINUOUS; + case "DISCRETE": + return RestorePointType.DISCRETE; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SecurityAlertPolicyState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SecurityAlertPolicyState.cs new file mode 100644 index 000000000000..58d6ac595bed --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SecurityAlertPolicyState.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SecurityAlertPolicyState. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SecurityAlertPolicyState + { + [EnumMember(Value = "New")] + New, + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class SecurityAlertPolicyStateEnumExtension + { + internal static string ToSerializedValue(this SecurityAlertPolicyState? value) + { + return value == null ? null : ((SecurityAlertPolicyState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SecurityAlertPolicyState value) + { + switch( value ) + { + case SecurityAlertPolicyState.New: + return "New"; + case SecurityAlertPolicyState.Enabled: + return "Enabled"; + case SecurityAlertPolicyState.Disabled: + return "Disabled"; + } + return null; + } + + internal static SecurityAlertPolicyState? ParseSecurityAlertPolicyState(this string value) + { + switch( value ) + { + case "New": + return SecurityAlertPolicyState.New; + case "Enabled": + return SecurityAlertPolicyState.Enabled; + case "Disabled": + return SecurityAlertPolicyState.Disabled; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SensitivityLabel.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SensitivityLabel.cs new file mode 100644 index 000000000000..699270aed09d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SensitivityLabel.cs @@ -0,0 +1,99 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A sensitivity label. + /// + [Rest.Serialization.JsonTransformation] + public partial class SensitivityLabel : ProxyResource + { + /// + /// Initializes a new instance of the SensitivityLabel class. + /// + public SensitivityLabel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SensitivityLabel 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The label name. + /// The label ID. + /// The information type. + /// The information type ID. + /// Is sensitivity recommendation disabled. + /// Applicable for recommended sensitivity label only. Specifies + /// whether the sensitivity recommendation on this column is disabled + /// (dismissed) or not. + public SensitivityLabel(string id = default(string), string name = default(string), string type = default(string), string labelName = default(string), string labelId = default(string), string informationType = default(string), string informationTypeId = default(string), bool? isDisabled = default(bool?)) + : base(id, name, type) + { + LabelName = labelName; + LabelId = labelId; + InformationType = informationType; + InformationTypeId = informationTypeId; + IsDisabled = isDisabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the label name. + /// + [JsonProperty(PropertyName = "properties.labelName")] + public string LabelName { get; set; } + + /// + /// Gets or sets the label ID. + /// + [JsonProperty(PropertyName = "properties.labelId")] + public string LabelId { get; set; } + + /// + /// Gets or sets the information type. + /// + [JsonProperty(PropertyName = "properties.informationType")] + public string InformationType { get; set; } + + /// + /// Gets or sets the information type ID. + /// + [JsonProperty(PropertyName = "properties.informationTypeId")] + public string InformationTypeId { get; set; } + + /// + /// Gets is sensitivity recommendation disabled. Applicable for + /// recommended sensitivity label only. Specifies whether the + /// sensitivity recommendation on this column is disabled (dismissed) + /// or not. + /// + [JsonProperty(PropertyName = "properties.isDisabled")] + public bool? IsDisabled { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SensitivityLabelListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SensitivityLabelListResult.cs new file mode 100644 index 000000000000..70fab0864260 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SensitivityLabelListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of sensitivity labels. + /// + public partial class SensitivityLabelListResult + { + /// + /// Initializes a new instance of the SensitivityLabelListResult class. + /// + public SensitivityLabelListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SensitivityLabelListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public SensitivityLabelListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Sku.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..98d551678a4d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Sku.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sku + /// + /// + /// SQL pool SKU + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The service tier + /// The SKU name + public Sku(string tier = default(string), string name = default(string)) + { + Tier = tier; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the service tier + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets the SKU name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs new file mode 100644 index 000000000000..6959efc33e3c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs @@ -0,0 +1,153 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SQL pool + /// + /// + /// A SQL Analytics pool + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPool : TrackedResource + { + /// + /// Initializes a new instance of the SqlPool class. + /// + public SqlPool() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPool 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// SQL pool SKU + /// Maximum size in bytes + /// Collation mode + /// Source database to create + /// from + /// Backup database to restore + /// from + /// Resource state + /// Resource status + /// Snapshot time to restore + /// What is this? + /// Date the SQL pool was created + public SqlPool(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), long? maxSizeBytes = default(long?), string collation = default(string), string sourceDatabaseId = default(string), string recoverableDatabaseId = default(string), string provisioningState = default(string), string status = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string createMode = default(string), System.DateTime? creationDate = default(System.DateTime?)) + : base(location, id, name, type, tags) + { + Sku = sku; + MaxSizeBytes = maxSizeBytes; + Collation = collation; + SourceDatabaseId = sourceDatabaseId; + RecoverableDatabaseId = recoverableDatabaseId; + ProvisioningState = provisioningState; + Status = status; + RestorePointInTime = restorePointInTime; + CreateMode = createMode; + CreationDate = creationDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SQL pool SKU + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets maximum size in bytes + /// + [JsonProperty(PropertyName = "properties.maxSizeBytes")] + public long? MaxSizeBytes { get; set; } + + /// + /// Gets or sets collation mode + /// + [JsonProperty(PropertyName = "properties.collation")] + public string Collation { get; set; } + + /// + /// Gets or sets source database to create from + /// + [JsonProperty(PropertyName = "properties.sourceDatabaseId")] + public string SourceDatabaseId { get; set; } + + /// + /// Gets or sets backup database to restore from + /// + [JsonProperty(PropertyName = "properties.recoverableDatabaseId")] + public string RecoverableDatabaseId { get; set; } + + /// + /// Gets or sets resource state + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets resource status + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets snapshot time to restore + /// + [JsonProperty(PropertyName = "properties.restorePointInTime")] + public System.DateTime? RestorePointInTime { get; set; } + + /// + /// Gets or sets what is this? + /// + [JsonProperty(PropertyName = "properties.createMode")] + public string CreateMode { get; set; } + + /// + /// Gets or sets date the SQL pool was created + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolBlobAuditingPolicy.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolBlobAuditingPolicy.cs new file mode 100644 index 000000000000..58f12a58aa60 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolBlobAuditingPolicy.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Sql pool blob auditing policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolBlobAuditingPolicy : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolBlobAuditingPolicy class. + /// + public SqlPoolBlobAuditingPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolBlobAuditingPolicy class. + /// + /// Specifies the state of the policy. If state is + /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + /// required. Possible values include: 'Enabled', 'Disabled' + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource kind. + /// Specifies the blob storage endpoint + /// (e.g. https://MyAccount.blob.core.windows.net). If state is + /// Enabled, storageEndpoint is required. + /// Specifies the identifier key + /// of the auditing storage account. If state is Enabled and + /// storageEndpoint is specified, storageAccountAccessKey is + /// required. + /// Specifies the number of days to keep in + /// the audit logs in the storage account. + /// Specifies the Actions-Groups + /// and Actions to audit. + /// + /// The recommended set of action groups to use is the following + /// combination - this will audit all the queries and stored procedures + /// executed against the database, as well as successful and failed + /// logins: + /// + /// BATCH_COMPLETED_GROUP, + /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + /// FAILED_DATABASE_AUTHENTICATION_GROUP. + /// + /// This above combination is also the set that is configured by + /// default when enabling auditing from the Azure portal. + /// + /// The supported action groups to audit are (note: choose only + /// specific groups that cover your auditing needs. Using unnecessary + /// groups could lead to very large quantities of audit records): + /// + /// APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + /// BACKUP_RESTORE_GROUP + /// DATABASE_LOGOUT_GROUP + /// DATABASE_OBJECT_CHANGE_GROUP + /// DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + /// DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + /// DATABASE_OPERATION_GROUP + /// DATABASE_PERMISSION_CHANGE_GROUP + /// DATABASE_PRINCIPAL_CHANGE_GROUP + /// DATABASE_PRINCIPAL_IMPERSONATION_GROUP + /// DATABASE_ROLE_MEMBER_CHANGE_GROUP + /// FAILED_DATABASE_AUTHENTICATION_GROUP + /// SCHEMA_OBJECT_ACCESS_GROUP + /// SCHEMA_OBJECT_CHANGE_GROUP + /// SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + /// SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + /// USER_CHANGE_PASSWORD_GROUP + /// BATCH_STARTED_GROUP + /// BATCH_COMPLETED_GROUP + /// + /// These are groups that cover all sql statements and stored + /// procedures executed against the database, and should not be used in + /// combination with other groups as this will result in duplicate + /// audit logs. + /// + /// For more information, see [Database-Level Audit Action + /// Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + /// + /// For Database auditing policy, specific Actions can also be + /// specified (note that Actions cannot be specified for Server + /// auditing policy). The supported actions to audit are: + /// SELECT + /// UPDATE + /// INSERT + /// DELETE + /// EXECUTE + /// RECEIVE + /// REFERENCES + /// + /// The general form for defining an action to be audited is: + /// {action} ON {object} BY {principal} + /// + /// Note that <object> in the above format can refer to an object + /// like a table, view, or stored procedure, or an entire database or + /// schema. For the latter cases, the forms DATABASE::{db_name} and + /// SCHEMA::{schema_name} are used, respectively. + /// + /// For example: + /// SELECT on dbo.myTable by public + /// SELECT on DATABASE::myDatabase by public + /// SELECT on SCHEMA::mySchema by public + /// + /// For more information, see [Database-Level Audit + /// Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + /// Specifies the blob + /// storage subscription Id. + /// Specifies whether + /// storageAccountAccessKey value is the storage's secondary + /// key. + /// Specifies whether audit + /// events are sent to Azure Monitor. + /// In order to send the events to Azure Monitor, specify 'state' as + /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'SQLSecurityAuditEvents' diagnostic logs category on the database + /// should be also created. + /// Note that for server level audit you should use the 'master' + /// database as {databaseName}. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// + public SqlPoolBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?)) + : base(id, name, type) + { + Kind = kind; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + RetentionDays = retentionDays; + AuditActionsAndGroups = auditActionsAndGroups; + StorageAccountSubscriptionId = storageAccountSubscriptionId; + IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource kind. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets or sets specifies the state of the policy. If state is + /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + /// required. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. If state is Enabled and storageEndpoint is specified, + /// storageAccountAccessKey is required. + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the number of days to keep in the audit logs + /// in the storage account. + /// + [JsonProperty(PropertyName = "properties.retentionDays")] + public int? RetentionDays { get; set; } + + /// + /// Gets or sets specifies the Actions-Groups and Actions to audit. + /// + /// The recommended set of action groups to use is the following + /// combination - this will audit all the queries and stored procedures + /// executed against the database, as well as successful and failed + /// logins: + /// + /// BATCH_COMPLETED_GROUP, + /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + /// FAILED_DATABASE_AUTHENTICATION_GROUP. + /// + /// This above combination is also the set that is configured by + /// default when enabling auditing from the Azure portal. + /// + /// The supported action groups to audit are (note: choose only + /// specific groups that cover your auditing needs. Using unnecessary + /// groups could lead to very large quantities of audit records): + /// + /// APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + /// BACKUP_RESTORE_GROUP + /// DATABASE_LOGOUT_GROUP + /// DATABASE_OBJECT_CHANGE_GROUP + /// DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + /// DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + /// DATABASE_OPERATION_GROUP + /// DATABASE_PERMISSION_CHANGE_GROUP + /// DATABASE_PRINCIPAL_CHANGE_GROUP + /// DATABASE_PRINCIPAL_IMPERSONATION_GROUP + /// DATABASE_ROLE_MEMBER_CHANGE_GROUP + /// FAILED_DATABASE_AUTHENTICATION_GROUP + /// SCHEMA_OBJECT_ACCESS_GROUP + /// SCHEMA_OBJECT_CHANGE_GROUP + /// SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + /// SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + /// SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + /// USER_CHANGE_PASSWORD_GROUP + /// BATCH_STARTED_GROUP + /// BATCH_COMPLETED_GROUP + /// + /// These are groups that cover all sql statements and stored + /// procedures executed against the database, and should not be used in + /// combination with other groups as this will result in duplicate + /// audit logs. + /// + /// For more information, see [Database-Level Audit Action + /// Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). + /// + /// For Database auditing policy, specific Actions can also be + /// specified (note that Actions cannot be specified for Server + /// auditing policy). The supported actions to audit are: + /// SELECT + /// UPDATE + /// INSERT + /// DELETE + /// EXECUTE + /// RECEIVE + /// REFERENCES + /// + /// The general form for defining an action to be audited is: + /// {action} ON {object} BY {principal} + /// + /// Note that &lt;object&gt; in the above format can refer to + /// an object like a table, view, or stored procedure, or an entire + /// database or schema. For the latter cases, the forms + /// DATABASE::{db_name} and SCHEMA::{schema_name} are used, + /// respectively. + /// + /// For example: + /// SELECT on dbo.myTable by public + /// SELECT on DATABASE::myDatabase by public + /// SELECT on SCHEMA::mySchema by public + /// + /// For more information, see [Database-Level Audit + /// Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + /// + [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] + public IList AuditActionsAndGroups { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + + /// + /// Gets or sets specifies whether storageAccountAccessKey value is the + /// storage's secondary key. + /// + [JsonProperty(PropertyName = "properties.isStorageSecondaryKeyInUse")] + public bool? IsStorageSecondaryKeyInUse { get; set; } + + /// + /// Gets or sets specifies whether audit events are sent to Azure + /// Monitor. + /// In order to send the events to Azure Monitor, specify 'state' as + /// 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'SQLSecurityAuditEvents' diagnostic logs category on the database + /// should be also created. + /// Note that for server level audit you should use the 'master' + /// database as {databaseName}. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// + /// + [JsonProperty(PropertyName = "properties.isAzureMonitorTargetEnabled")] + public bool? IsAzureMonitorTargetEnabled { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolBlobAuditingPolicySqlPoolOperationListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolBlobAuditingPolicySqlPoolOperationListResult.cs new file mode 100644 index 000000000000..c66ac1b6e665 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolBlobAuditingPolicySqlPoolOperationListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response to a list Sql pool operations request + /// + public partial class SqlPoolBlobAuditingPolicySqlPoolOperationListResult + { + /// + /// Initializes a new instance of the + /// SqlPoolBlobAuditingPolicySqlPoolOperationListResult class. + /// + public SqlPoolBlobAuditingPolicySqlPoolOperationListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlPoolBlobAuditingPolicySqlPoolOperationListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public SqlPoolBlobAuditingPolicySqlPoolOperationListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolColumn.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolColumn.cs new file mode 100644 index 000000000000..2163271fe347 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolColumn.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Sql pool column resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolColumn : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolColumn class. + /// + public SqlPoolColumn() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolColumn 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The column data type. Possible values + /// include: 'image', 'text', 'uniqueidentifier', 'date', 'time', + /// 'datetime2', 'datetimeoffset', 'tinyint', 'smallint', 'int', + /// 'smalldatetime', 'real', 'money', 'datetime', 'float', + /// 'sql_variant', 'ntext', 'bit', 'decimal', 'numeric', 'smallmoney', + /// 'bigint', 'hierarchyid', 'geometry', 'geography', 'varbinary', + /// 'varchar', 'binary', 'char', 'timestamp', 'nvarchar', 'nchar', + /// 'xml', 'sysname' + public SqlPoolColumn(string id = default(string), string name = default(string), string type = default(string), string columnType = default(string)) + : base(id, name, type) + { + ColumnType = columnType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the column data type. Possible values include: + /// 'image', 'text', 'uniqueidentifier', 'date', 'time', 'datetime2', + /// 'datetimeoffset', 'tinyint', 'smallint', 'int', 'smalldatetime', + /// 'real', 'money', 'datetime', 'float', 'sql_variant', 'ntext', + /// 'bit', 'decimal', 'numeric', 'smallmoney', 'bigint', 'hierarchyid', + /// 'geometry', 'geography', 'varbinary', 'varchar', 'binary', 'char', + /// 'timestamp', 'nvarchar', 'nchar', 'xml', 'sysname' + /// + [JsonProperty(PropertyName = "properties.columnType")] + public string ColumnType { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolColumnListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolColumnListResult.cs new file mode 100644 index 000000000000..967453df0445 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolColumnListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of Sql pool columns. + /// + public partial class SqlPoolColumnListResult + { + /// + /// Initializes a new instance of the SqlPoolColumnListResult class. + /// + public SqlPoolColumnListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolColumnListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public SqlPoolColumnListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolConnectionPolicy.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolConnectionPolicy.cs new file mode 100644 index 000000000000..1701a1f9e793 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolConnectionPolicy.cs @@ -0,0 +1,131 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Sql pool connection policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolConnectionPolicy : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolConnectionPolicy class. + /// + public SqlPoolConnectionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolConnectionPolicy 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource kind. + /// Resource location. + /// The state of security + /// access. + /// The fully qualified host name of the + /// auditing proxy. + /// The port number of the auditing + /// proxy. + /// The visibility of the auditing + /// proxy. + /// Whether server default is enabled or + /// disabled. + /// The state of proxy + /// redirection. + /// The connection policy state. + public SqlPoolConnectionPolicy(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string securityEnabledAccess = default(string), string proxyDnsName = default(string), string proxyPort = default(string), string visibility = default(string), string useServerDefault = default(string), string redirectionState = default(string), string state = default(string)) + : base(id, name, type) + { + Kind = kind; + Location = location; + SecurityEnabledAccess = securityEnabledAccess; + ProxyDnsName = proxyDnsName; + ProxyPort = proxyPort; + Visibility = visibility; + UseServerDefault = useServerDefault; + RedirectionState = redirectionState; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource kind. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets or sets the state of security access. + /// + [JsonProperty(PropertyName = "properties.securityEnabledAccess")] + public string SecurityEnabledAccess { get; set; } + + /// + /// Gets or sets the fully qualified host name of the auditing proxy. + /// + [JsonProperty(PropertyName = "properties.proxyDnsName")] + public string ProxyDnsName { get; set; } + + /// + /// Gets or sets the port number of the auditing proxy. + /// + [JsonProperty(PropertyName = "properties.proxyPort")] + public string ProxyPort { get; set; } + + /// + /// Gets or sets the visibility of the auditing proxy. + /// + [JsonProperty(PropertyName = "properties.visibility")] + public string Visibility { get; set; } + + /// + /// Gets or sets whether server default is enabled or disabled. + /// + [JsonProperty(PropertyName = "properties.useServerDefault")] + public string UseServerDefault { get; set; } + + /// + /// Gets or sets the state of proxy redirection. + /// + [JsonProperty(PropertyName = "properties.redirectionState")] + public string RedirectionState { get; set; } + + /// + /// Gets or sets the connection policy state. + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolInfoListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolInfoListResult.cs new file mode 100644 index 000000000000..052b2b84cf44 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolInfoListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SQL pool collection + /// + /// + /// List of SQL pools + /// + public partial class SqlPoolInfoListResult + { + /// + /// Initializes a new instance of the SqlPoolInfoListResult class. + /// + public SqlPoolInfoListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolInfoListResult class. + /// + /// Link to the next page of results + /// List of SQL pools + public SqlPoolInfoListResult(string nextLink = default(string), IList value = default(IList)) + { + NextLink = nextLink; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets link to the next page of results + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Gets or sets list of SQL pools + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolOperation.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolOperation.cs new file mode 100644 index 000000000000..17349c1b49d9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolOperation.cs @@ -0,0 +1,176 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Sql pool operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolOperation : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolOperation class. + /// + public SqlPoolOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolOperation 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The name of the Sql pool the operation + /// is being performed on. + /// The name of operation. + /// The friendly name of + /// operation. + /// The percentage of the operation + /// completed. + /// The name of the server. + /// The operation start time. + /// The operation state. Possible values include: + /// 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + /// 'Cancelled' + /// The operation error code. + /// The operation error + /// description. + /// The operation error severity. + /// Whether or not the error is a user + /// error. + /// The estimated completion time + /// of the operation. + /// The operation description. + /// Whether the operation can be + /// cancelled. + public SqlPoolOperation(string id = default(string), string name = default(string), string type = default(string), string databaseName = default(string), string operation = default(string), string operationFriendlyName = default(string), int? percentComplete = default(int?), string serverName = default(string), System.DateTime? startTime = default(System.DateTime?), string state = default(string), int? errorCode = default(int?), string errorDescription = default(string), int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTime? estimatedCompletionTime = default(System.DateTime?), string description = default(string), bool? isCancellable = default(bool?)) + : base(id, name, type) + { + DatabaseName = databaseName; + Operation = operation; + OperationFriendlyName = operationFriendlyName; + PercentComplete = percentComplete; + ServerName = serverName; + StartTime = startTime; + State = state; + ErrorCode = errorCode; + ErrorDescription = errorDescription; + ErrorSeverity = errorSeverity; + IsUserError = isUserError; + EstimatedCompletionTime = estimatedCompletionTime; + Description = description; + IsCancellable = isCancellable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the Sql pool the operation is being performed on. + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Gets the name of operation. + /// + [JsonProperty(PropertyName = "properties.operation")] + public string Operation { get; private set; } + + /// + /// Gets the friendly name of operation. + /// + [JsonProperty(PropertyName = "properties.operationFriendlyName")] + public string OperationFriendlyName { get; private set; } + + /// + /// Gets the percentage of the operation completed. + /// + [JsonProperty(PropertyName = "properties.percentComplete")] + public int? PercentComplete { get; private set; } + + /// + /// Gets the name of the server. + /// + [JsonProperty(PropertyName = "properties.serverName")] + public string ServerName { get; private set; } + + /// + /// Gets the operation start time. + /// + [JsonProperty(PropertyName = "properties.startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the operation state. Possible values include: 'Pending', + /// 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + /// 'Cancelled' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets the operation error code. + /// + [JsonProperty(PropertyName = "properties.errorCode")] + public int? ErrorCode { get; private set; } + + /// + /// Gets the operation error description. + /// + [JsonProperty(PropertyName = "properties.errorDescription")] + public string ErrorDescription { get; private set; } + + /// + /// Gets the operation error severity. + /// + [JsonProperty(PropertyName = "properties.errorSeverity")] + public int? ErrorSeverity { get; private set; } + + /// + /// Gets whether or not the error is a user error. + /// + [JsonProperty(PropertyName = "properties.isUserError")] + public bool? IsUserError { get; private set; } + + /// + /// Gets the estimated completion time of the operation. + /// + [JsonProperty(PropertyName = "properties.estimatedCompletionTime")] + public System.DateTime? EstimatedCompletionTime { get; private set; } + + /// + /// Gets the operation description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets whether the operation can be cancelled. + /// + [JsonProperty(PropertyName = "properties.isCancellable")] + public bool? IsCancellable { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs new file mode 100644 index 000000000000..6c37263892d3 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs @@ -0,0 +1,150 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SQL pool patch info + /// + /// + /// A SQL Analytics pool patch info + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolPatchInfo + { + /// + /// Initializes a new instance of the SqlPoolPatchInfo class. + /// + public SqlPoolPatchInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolPatchInfo class. + /// + /// Resource tags. + /// The geo-location where the resource + /// lives + /// SQL pool SKU + /// Maximum size in bytes + /// Collation mode + /// Source database to create + /// from + /// Backup database to restore + /// from + /// Resource state + /// Resource status + /// Snapshot time to restore + /// What is this? + /// Date the SQL pool was created + public SqlPoolPatchInfo(IDictionary tags = default(IDictionary), string location = default(string), Sku sku = default(Sku), long? maxSizeBytes = default(long?), string collation = default(string), string sourceDatabaseId = default(string), string recoverableDatabaseId = default(string), string provisioningState = default(string), string status = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string createMode = default(string), System.DateTime? creationDate = default(System.DateTime?)) + { + Tags = tags; + Location = location; + Sku = sku; + MaxSizeBytes = maxSizeBytes; + Collation = collation; + SourceDatabaseId = sourceDatabaseId; + RecoverableDatabaseId = recoverableDatabaseId; + ProvisioningState = provisioningState; + Status = status; + RestorePointInTime = restorePointInTime; + CreateMode = createMode; + CreationDate = creationDate; + 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; } + + /// + /// Gets or sets SQL pool SKU + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets maximum size in bytes + /// + [JsonProperty(PropertyName = "properties.maxSizeBytes")] + public long? MaxSizeBytes { get; set; } + + /// + /// Gets or sets collation mode + /// + [JsonProperty(PropertyName = "properties.collation")] + public string Collation { get; set; } + + /// + /// Gets or sets source database to create from + /// + [JsonProperty(PropertyName = "properties.sourceDatabaseId")] + public string SourceDatabaseId { get; set; } + + /// + /// Gets or sets backup database to restore from + /// + [JsonProperty(PropertyName = "properties.recoverableDatabaseId")] + public string RecoverableDatabaseId { get; set; } + + /// + /// Gets or sets resource state + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets resource status + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets snapshot time to restore + /// + [JsonProperty(PropertyName = "properties.restorePointInTime")] + public System.DateTime? RestorePointInTime { get; set; } + + /// + /// Gets or sets what is this? + /// + [JsonProperty(PropertyName = "properties.createMode")] + public string CreateMode { get; set; } + + /// + /// Gets or sets date the SQL pool was created + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSchema.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSchema.cs new file mode 100644 index 000000000000..a987e8cf4863 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSchema.cs @@ -0,0 +1,49 @@ +// +// 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.Synapse.Models +{ + using System.Linq; + + /// + /// A Sql pool schema resource. + /// + public partial class SqlPoolSchema : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolSchema class. + /// + public SqlPoolSchema() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolSchema 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public SqlPoolSchema(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSchemaListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSchemaListResult.cs new file mode 100644 index 000000000000..af8e20c0edcb --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSchemaListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of Sql pool schemas. + /// + public partial class SqlPoolSchemaListResult + { + /// + /// Initializes a new instance of the SqlPoolSchemaListResult class. + /// + public SqlPoolSchemaListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolSchemaListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public SqlPoolSchemaListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSecurityAlertPolicy.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSecurityAlertPolicy.cs new file mode 100644 index 000000000000..f9165077f6a4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolSecurityAlertPolicy.cs @@ -0,0 +1,152 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Sql pool security alert policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolSecurityAlertPolicy : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolSecurityAlertPolicy class. + /// + public SqlPoolSecurityAlertPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolSecurityAlertPolicy class. + /// + /// Specifies the state of the policy, whether it + /// is enabled or disabled or a policy has not been applied yet on the + /// specific Sql pool. Possible values include: 'New', 'Enabled', + /// 'Disabled' + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Specifies an array of alerts that are + /// disabled. Allowed values are: Sql_Injection, + /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, + /// Unsafe_Action + /// Specifies an array of e-mail addresses + /// to which the alert is sent. + /// Specifies that the alert is sent + /// to the account administrators. + /// Specifies the blob storage endpoint + /// (e.g. https://MyAccount.blob.core.windows.net). This blob storage + /// will hold all Threat Detection audit logs. + /// Specifies the identifier key + /// of the Threat Detection audit storage account. + /// Specifies the number of days to keep in + /// the Threat Detection audit logs. + /// Specifies the UTC creation time of the + /// policy. + public SqlPoolSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) + : base(id, name, type) + { + State = state; + DisabledAlerts = disabledAlerts; + EmailAddresses = emailAddresses; + EmailAccountAdmins = emailAccountAdmins; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + RetentionDays = retentionDays; + CreationTime = creationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the state of the policy, whether it is + /// enabled or disabled or a policy has not been applied yet on the + /// specific Sql pool. Possible values include: 'New', 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public SecurityAlertPolicyState State { get; set; } + + /// + /// Gets or sets specifies an array of alerts that are disabled. + /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// + [JsonProperty(PropertyName = "properties.disabledAlerts")] + public IList DisabledAlerts { get; set; } + + /// + /// Gets or sets specifies an array of e-mail addresses to which the + /// alert is sent. + /// + [JsonProperty(PropertyName = "properties.emailAddresses")] + public IList EmailAddresses { get; set; } + + /// + /// Gets or sets specifies that the alert is sent to the account + /// administrators. + /// + [JsonProperty(PropertyName = "properties.emailAccountAdmins")] + public bool? EmailAccountAdmins { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). This blob storage will + /// hold all Threat Detection audit logs. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the Threat Detection + /// audit storage account. + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the number of days to keep in the Threat + /// Detection audit logs. + /// + [JsonProperty(PropertyName = "properties.retentionDays")] + public int? RetentionDays { get; set; } + + /// + /// Gets specifies the UTC creation time of the policy. + /// + [JsonProperty(PropertyName = "properties.creationTime")] + public System.DateTime? CreationTime { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolTable.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolTable.cs new file mode 100644 index 000000000000..32783337ba49 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolTable.cs @@ -0,0 +1,49 @@ +// +// 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.Synapse.Models +{ + using System.Linq; + + /// + /// A Sql pool table resource. + /// + public partial class SqlPoolTable : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolTable class. + /// + public SqlPoolTable() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolTable 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public SqlPoolTable(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolTableListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolTableListResult.cs new file mode 100644 index 000000000000..3f4969c84154 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolTableListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of Sql pool tables. + /// + public partial class SqlPoolTableListResult + { + /// + /// Initializes a new instance of the SqlPoolTableListResult class. + /// + public SqlPoolTableListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolTableListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public SqlPoolTableListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolUsage.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolUsage.cs new file mode 100644 index 000000000000..3bbc1f9ad139 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolUsage.cs @@ -0,0 +1,101 @@ +// +// 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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Sql pool usages. + /// + public partial class SqlPoolUsage + { + /// + /// Initializes a new instance of the SqlPoolUsage class. + /// + public SqlPoolUsage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolUsage class. + /// + /// The name of the usage metric. + /// The name of the resource. + /// The usage metric display name. + /// The current value of the usage + /// metric. + /// The current limit of the usage metric. + /// The units of the usage metric. + /// The next reset time for the usage + /// metric (ISO8601 format). + public SqlPoolUsage(string name = default(string), string resourceName = default(string), string displayName = default(string), double? currentValue = default(double?), double? limit = default(double?), string unit = default(string), System.DateTime? nextResetTime = default(System.DateTime?)) + { + Name = name; + ResourceName = resourceName; + DisplayName = displayName; + CurrentValue = currentValue; + Limit = limit; + Unit = unit; + NextResetTime = nextResetTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the usage metric. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the name of the resource. + /// + [JsonProperty(PropertyName = "resourceName")] + public string ResourceName { get; private set; } + + /// + /// Gets the usage metric display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the current value of the usage metric. + /// + [JsonProperty(PropertyName = "currentValue")] + public double? CurrentValue { get; private set; } + + /// + /// Gets the current limit of the usage metric. + /// + [JsonProperty(PropertyName = "limit")] + public double? Limit { get; private set; } + + /// + /// Gets the units of the usage metric. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets the next reset time for the usage metric (ISO8601 format). + /// + [JsonProperty(PropertyName = "nextResetTime")] + public System.DateTime? NextResetTime { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolUsageListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolUsageListResult.cs new file mode 100644 index 000000000000..53febedc7607 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolUsageListResult.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response to a list Sql pool usages request. + /// + public partial class SqlPoolUsageListResult + { + /// + /// Initializes a new instance of the SqlPoolUsageListResult class. + /// + public SqlPoolUsageListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolUsageListResult class. + /// + /// The list of usages for the Sql pool. + /// Link to retrieve next page of + /// results. + public SqlPoolUsageListResult(IList value, string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of usages for the Sql pool. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessment.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessment.cs new file mode 100644 index 000000000000..57c18c322a08 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessment.cs @@ -0,0 +1,105 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Sql pool vulnerability assessment. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolVulnerabilityAssessment : ProxyResource + { + /// + /// Initializes a new instance of the SqlPoolVulnerabilityAssessment + /// class. + /// + public SqlPoolVulnerabilityAssessment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlPoolVulnerabilityAssessment + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// A blob storage container path to + /// hold the scan results (e.g. + /// https://myStorage.blob.core.windows.net/VaScans/). It is required + /// if server level vulnerability assessment policy doesn't set + /// A shared access signature (SAS + /// Key) that has write access to the blob container specified in + /// 'storageContainerPath' parameter. If 'storageAccountAccessKey' + /// isn't specified, StorageContainerSasKey is required. + /// Specifies the identifier key + /// of the storage account for vulnerability assessment scan results. + /// If 'StorageContainerSasKey' isn't specified, + /// storageAccountAccessKey is required. + /// The recurring scans settings + public SqlPoolVulnerabilityAssessment(string id = default(string), string name = default(string), string type = default(string), string storageContainerPath = default(string), string storageContainerSasKey = default(string), string storageAccountAccessKey = default(string), VulnerabilityAssessmentRecurringScansProperties recurringScans = default(VulnerabilityAssessmentRecurringScansProperties)) + : base(id, name, type) + { + StorageContainerPath = storageContainerPath; + StorageContainerSasKey = storageContainerSasKey; + StorageAccountAccessKey = storageAccountAccessKey; + RecurringScans = recurringScans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a blob storage container path to hold the scan results + /// (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is + /// required if server level vulnerability assessment policy doesn't + /// set + /// + [JsonProperty(PropertyName = "properties.storageContainerPath")] + public string StorageContainerPath { get; set; } + + /// + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. + /// + [JsonProperty(PropertyName = "properties.storageContainerSasKey")] + public string StorageContainerSasKey { get; set; } + + /// + /// Gets or sets specifies the identifier key of the storage account + /// for vulnerability assessment scan results. If + /// 'StorageContainerSasKey' isn't specified, storageAccountAccessKey + /// is required. + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets the recurring scans settings + /// + [JsonProperty(PropertyName = "properties.recurringScans")] + public VulnerabilityAssessmentRecurringScansProperties RecurringScans { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentListResult.cs new file mode 100644 index 000000000000..7fddbf9769c6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of the Sql pool's vulnerability assessments. + /// + public partial class SqlPoolVulnerabilityAssessmentListResult + { + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentListResult class. + /// + public SqlPoolVulnerabilityAssessmentListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public SqlPoolVulnerabilityAssessmentListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentRuleBaseline.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentRuleBaseline.cs new file mode 100644 index 000000000000..15a706002d95 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentRuleBaseline.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Sql pool vulnerability assessment rule baseline. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolVulnerabilityAssessmentRuleBaseline : ProxyResource + { + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentRuleBaseline class. + /// + public SqlPoolVulnerabilityAssessmentRuleBaseline() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentRuleBaseline class. + /// + /// The rule baseline result + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public SqlPoolVulnerabilityAssessmentRuleBaseline(IList baselineResults, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + BaselineResults = baselineResults; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rule baseline result + /// + [JsonProperty(PropertyName = "properties.baselineResults")] + public IList BaselineResults { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BaselineResults == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BaselineResults"); + } + if (BaselineResults != null) + { + foreach (var element in BaselineResults) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentRuleBaselineItem.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentRuleBaselineItem.cs new file mode 100644 index 000000000000..f497299a5845 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentRuleBaselineItem.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.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties for an Sql pool vulnerability assessment rule baseline's + /// result. + /// + public partial class SqlPoolVulnerabilityAssessmentRuleBaselineItem + { + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentRuleBaselineItem class. + /// + public SqlPoolVulnerabilityAssessmentRuleBaselineItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentRuleBaselineItem class. + /// + /// The rule baseline result + public SqlPoolVulnerabilityAssessmentRuleBaselineItem(IList result) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rule baseline result + /// + [JsonProperty(PropertyName = "result")] + public IList Result { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Result == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Result"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentScansExport.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentScansExport.cs new file mode 100644 index 000000000000..b5f01931e962 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolVulnerabilityAssessmentScansExport.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Sql pool Vulnerability Assessment scan export resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlPoolVulnerabilityAssessmentScansExport : ProxyResource + { + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentScansExport class. + /// + public SqlPoolVulnerabilityAssessmentScansExport() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SqlPoolVulnerabilityAssessmentScansExport 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Location of the exported + /// report (e.g. + /// https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + public SqlPoolVulnerabilityAssessmentScansExport(string id = default(string), string name = default(string), string type = default(string), string exportedReportLocation = default(string)) + : base(id, name, type) + { + ExportedReportLocation = exportedReportLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the exported report (e.g. + /// https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + /// + [JsonProperty(PropertyName = "properties.exportedReportLocation")] + public string ExportedReportLocation { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TopQueries.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TopQueries.cs new file mode 100644 index 000000000000..f67a9f768e7e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TopQueries.cs @@ -0,0 +1,125 @@ +// +// 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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A database query. + /// + public partial class TopQueries + { + /// + /// Initializes a new instance of the TopQueries class. + /// + public TopQueries() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TopQueries class. + /// + /// The function that is used to + /// aggregate each query's metrics. Possible values include: 'min', + /// 'max', 'avg', 'sum' + /// The execution type that is used to + /// filter the query instances that are returned. Possible values + /// include: 'any', 'regular', 'irregular', 'aborted', + /// 'exception' + /// The duration of the interval (ISO8601 + /// duration format). + /// The number of requested + /// queries. + /// The start time for queries that + /// are returned (ISO8601 format) + /// The end time for queries that are + /// returned (ISO8601 format) + /// The type of metric to use for ordering + /// the top metrics. Possible values include: 'cpu', 'io', 'logio', + /// 'duration', 'executionCount' + /// The list of queries. + public TopQueries(QueryAggregationFunction? aggregationFunction = default(QueryAggregationFunction?), QueryExecutionType? executionType = default(QueryExecutionType?), string intervalType = default(string), double? numberOfTopQueries = default(double?), System.DateTime? observationStartTime = default(System.DateTime?), System.DateTime? observationEndTime = default(System.DateTime?), QueryObservedMetricType? observedMetric = default(QueryObservedMetricType?), IList queries = default(IList)) + { + AggregationFunction = aggregationFunction; + ExecutionType = executionType; + IntervalType = intervalType; + NumberOfTopQueries = numberOfTopQueries; + ObservationStartTime = observationStartTime; + ObservationEndTime = observationEndTime; + ObservedMetric = observedMetric; + Queries = queries; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the function that is used to aggregate each query's metrics. + /// Possible values include: 'min', 'max', 'avg', 'sum' + /// + [JsonProperty(PropertyName = "aggregationFunction")] + public QueryAggregationFunction? AggregationFunction { get; private set; } + + /// + /// Gets the execution type that is used to filter the query instances + /// that are returned. Possible values include: 'any', 'regular', + /// 'irregular', 'aborted', 'exception' + /// + [JsonProperty(PropertyName = "executionType")] + public QueryExecutionType? ExecutionType { get; private set; } + + /// + /// Gets the duration of the interval (ISO8601 duration format). + /// + [JsonProperty(PropertyName = "intervalType")] + public string IntervalType { get; private set; } + + /// + /// Gets the number of requested queries. + /// + [JsonProperty(PropertyName = "numberOfTopQueries")] + public double? NumberOfTopQueries { get; private set; } + + /// + /// Gets the start time for queries that are returned (ISO8601 format) + /// + [JsonProperty(PropertyName = "observationStartTime")] + public System.DateTime? ObservationStartTime { get; private set; } + + /// + /// Gets the end time for queries that are returned (ISO8601 format) + /// + [JsonProperty(PropertyName = "observationEndTime")] + public System.DateTime? ObservationEndTime { get; private set; } + + /// + /// Gets the type of metric to use for ordering the top metrics. + /// Possible values include: 'cpu', 'io', 'logio', 'duration', + /// 'executionCount' + /// + [JsonProperty(PropertyName = "observedMetric")] + public QueryObservedMetricType? ObservedMetric { get; private set; } + + /// + /// Gets the list of queries. + /// + [JsonProperty(PropertyName = "queries")] + public IList Queries { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TopQueriesListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TopQueriesListResult.cs new file mode 100644 index 000000000000..017b923322da --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TopQueriesListResult.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents the response to a get top queries request. + /// + public partial class TopQueriesListResult + { + /// + /// Initializes a new instance of the TopQueriesListResult class. + /// + public TopQueriesListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TopQueriesListResult class. + /// + /// The list of top queries. + public TopQueriesListResult(IList value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of top queries. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TrackedResource.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..6f74296bf6d4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for a ARM tracked top level resource + /// + 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + 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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TransparentDataEncryption.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TransparentDataEncryption.cs new file mode 100644 index 000000000000..849b22a010ba --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TransparentDataEncryption.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a Sql pool transparent data encryption configuration. + /// + [Rest.Serialization.JsonTransformation] + public partial class TransparentDataEncryption : ProxyResource + { + /// + /// Initializes a new instance of the TransparentDataEncryption class. + /// + public TransparentDataEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransparentDataEncryption 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource location. + /// The status of the database transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' + public TransparentDataEncryption(string id = default(string), string name = default(string), string type = default(string), string location = default(string), TransparentDataEncryptionStatus? status = default(TransparentDataEncryptionStatus?)) + : base(id, name, type) + { + Location = location; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets or sets the status of the database transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.status")] + public TransparentDataEncryptionStatus? Status { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TransparentDataEncryptionStatus.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TransparentDataEncryptionStatus.cs new file mode 100644 index 000000000000..677392a2e352 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TransparentDataEncryptionStatus.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for TransparentDataEncryptionStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TransparentDataEncryptionStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class TransparentDataEncryptionStatusEnumExtension + { + internal static string ToSerializedValue(this TransparentDataEncryptionStatus? value) + { + return value == null ? null : ((TransparentDataEncryptionStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this TransparentDataEncryptionStatus value) + { + switch( value ) + { + case TransparentDataEncryptionStatus.Enabled: + return "Enabled"; + case TransparentDataEncryptionStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static TransparentDataEncryptionStatus? ParseTransparentDataEncryptionStatus(this string value) + { + switch( value ) + { + case "Enabled": + return TransparentDataEncryptionStatus.Enabled; + case "Disabled": + return TransparentDataEncryptionStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VirtualNetworkProfile.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VirtualNetworkProfile.cs new file mode 100644 index 000000000000..dd2386b1e10e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VirtualNetworkProfile.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Virtual Network Profile + /// + public partial class VirtualNetworkProfile + { + /// + /// Initializes a new instance of the VirtualNetworkProfile class. + /// + public VirtualNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkProfile class. + /// + /// Subnet ID used for computes in + /// workspace + public VirtualNetworkProfile(string computeSubnetId = default(string)) + { + ComputeSubnetId = computeSubnetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets subnet ID used for computes in workspace + /// + [JsonProperty(PropertyName = "computeSubnetId")] + public string ComputeSubnetId { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentPolicyBaselineName.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentPolicyBaselineName.cs new file mode 100644 index 000000000000..ef5f1cc29929 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentPolicyBaselineName.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.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for VulnerabilityAssessmentPolicyBaselineName. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum VulnerabilityAssessmentPolicyBaselineName + { + [EnumMember(Value = "master")] + Master, + [EnumMember(Value = "default")] + Default + } + internal static class VulnerabilityAssessmentPolicyBaselineNameEnumExtension + { + internal static string ToSerializedValue(this VulnerabilityAssessmentPolicyBaselineName? value) + { + return value == null ? null : ((VulnerabilityAssessmentPolicyBaselineName)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this VulnerabilityAssessmentPolicyBaselineName value) + { + switch( value ) + { + case VulnerabilityAssessmentPolicyBaselineName.Master: + return "master"; + case VulnerabilityAssessmentPolicyBaselineName.Default: + return "default"; + } + return null; + } + + internal static VulnerabilityAssessmentPolicyBaselineName? ParseVulnerabilityAssessmentPolicyBaselineName(this string value) + { + switch( value ) + { + case "master": + return VulnerabilityAssessmentPolicyBaselineName.Master; + case "default": + return VulnerabilityAssessmentPolicyBaselineName.Default; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentRecurringScansProperties.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentRecurringScansProperties.cs new file mode 100644 index 000000000000..36618e4e6296 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentRecurringScansProperties.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a Vulnerability Assessment recurring scans. + /// + public partial class VulnerabilityAssessmentRecurringScansProperties + { + /// + /// Initializes a new instance of the + /// VulnerabilityAssessmentRecurringScansProperties class. + /// + public VulnerabilityAssessmentRecurringScansProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VulnerabilityAssessmentRecurringScansProperties class. + /// + /// Recurring scans state. + /// Specifies that the schedule + /// scan notification will be is sent to the subscription + /// administrators. + /// Specifies an array of e-mail addresses to + /// which the scan notification is sent. + public VulnerabilityAssessmentRecurringScansProperties(bool? isEnabled = default(bool?), bool? emailSubscriptionAdmins = default(bool?), IList emails = default(IList)) + { + IsEnabled = isEnabled; + EmailSubscriptionAdmins = emailSubscriptionAdmins; + Emails = emails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets recurring scans state. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets specifies that the schedule scan notification will be + /// is sent to the subscription administrators. + /// + [JsonProperty(PropertyName = "emailSubscriptionAdmins")] + public bool? EmailSubscriptionAdmins { get; set; } + + /// + /// Gets or sets specifies an array of e-mail addresses to which the + /// scan notification is sent. + /// + [JsonProperty(PropertyName = "emails")] + public IList Emails { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanError.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanError.cs new file mode 100644 index 000000000000..21c25c4c26c4 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanError.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a vulnerability assessment scan error. + /// + public partial class VulnerabilityAssessmentScanError + { + /// + /// Initializes a new instance of the VulnerabilityAssessmentScanError + /// class. + /// + public VulnerabilityAssessmentScanError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VulnerabilityAssessmentScanError + /// class. + /// + /// The error code. + /// The error message. + public VulnerabilityAssessmentScanError(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanRecord.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanRecord.cs new file mode 100644 index 000000000000..a928896c08e9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanRecord.cs @@ -0,0 +1,127 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A vulnerability assessment scan record. + /// + [Rest.Serialization.JsonTransformation] + public partial class VulnerabilityAssessmentScanRecord : ProxyResource + { + /// + /// Initializes a new instance of the VulnerabilityAssessmentScanRecord + /// class. + /// + public VulnerabilityAssessmentScanRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VulnerabilityAssessmentScanRecord + /// 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The scan ID. + /// The scan trigger type. Possible values + /// include: 'OnDemand', 'Recurring' + /// The scan status. Possible values include: + /// 'Passed', 'Failed', 'FailedToRun', 'InProgress' + /// The scan start time (UTC). + /// The scan end time (UTC). + /// The scan errors. + /// The scan results storage + /// container path. + /// The number of failed + /// security checks. + public VulnerabilityAssessmentScanRecord(string id = default(string), string name = default(string), string type = default(string), string scanId = default(string), string triggerType = default(string), string state = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), IList errors = default(IList), string storageContainerPath = default(string), int? numberOfFailedSecurityChecks = default(int?)) + : base(id, name, type) + { + ScanId = scanId; + TriggerType = triggerType; + State = state; + StartTime = startTime; + EndTime = endTime; + Errors = errors; + StorageContainerPath = storageContainerPath; + NumberOfFailedSecurityChecks = numberOfFailedSecurityChecks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the scan ID. + /// + [JsonProperty(PropertyName = "properties.scanId")] + public string ScanId { get; private set; } + + /// + /// Gets the scan trigger type. Possible values include: 'OnDemand', + /// 'Recurring' + /// + [JsonProperty(PropertyName = "properties.triggerType")] + public string TriggerType { get; private set; } + + /// + /// Gets the scan status. Possible values include: 'Passed', 'Failed', + /// 'FailedToRun', 'InProgress' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets the scan start time (UTC). + /// + [JsonProperty(PropertyName = "properties.startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the scan end time (UTC). + /// + [JsonProperty(PropertyName = "properties.endTime")] + public System.DateTime? EndTime { get; private set; } + + /// + /// Gets the scan errors. + /// + [JsonProperty(PropertyName = "properties.errors")] + public IList Errors { get; private set; } + + /// + /// Gets the scan results storage container path. + /// + [JsonProperty(PropertyName = "properties.storageContainerPath")] + public string StorageContainerPath { get; private set; } + + /// + /// Gets the number of failed security checks. + /// + [JsonProperty(PropertyName = "properties.numberOfFailedSecurityChecks")] + public int? NumberOfFailedSecurityChecks { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanRecordListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanRecordListResult.cs new file mode 100644 index 000000000000..2696e2ceef85 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanRecordListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of vulnerability assessment scan records. + /// + public partial class VulnerabilityAssessmentScanRecordListResult + { + /// + /// Initializes a new instance of the + /// VulnerabilityAssessmentScanRecordListResult class. + /// + public VulnerabilityAssessmentScanRecordListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VulnerabilityAssessmentScanRecordListResult class. + /// + /// Array of results. + /// Link to retrieve next page of + /// results. + public VulnerabilityAssessmentScanRecordListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets array of results. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets link to retrieve next page of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanState.cs new file mode 100644 index 000000000000..c326e15c86ee --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanState.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.Synapse.Models +{ + + /// + /// Defines values for VulnerabilityAssessmentScanState. + /// + public static class VulnerabilityAssessmentScanState + { + public const string Passed = "Passed"; + public const string Failed = "Failed"; + public const string FailedToRun = "FailedToRun"; + public const string InProgress = "InProgress"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanTriggerType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanTriggerType.cs new file mode 100644 index 000000000000..ab391ca5c944 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/VulnerabilityAssessmentScanTriggerType.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.Synapse.Models +{ + + /// + /// Defines values for VulnerabilityAssessmentScanTriggerType. + /// + public static class VulnerabilityAssessmentScanTriggerType + { + public const string OnDemand = "OnDemand"; + public const string Recurring = "Recurring"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Workspace.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Workspace.cs new file mode 100644 index 000000000000..344401886764 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Workspace.cs @@ -0,0 +1,136 @@ +// +// 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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A workspace + /// + [Rest.Serialization.JsonTransformation] + public partial class Workspace : TrackedResource + { + /// + /// Initializes a new instance of the Workspace class. + /// + public Workspace() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Workspace 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// Workspace default data lake + /// storage account details + /// SQL administrator login + /// password + /// Workspace managed resource + /// group + /// Resource provisioning state + /// Login for workspace SQL active + /// directory administrator + /// Virtual Network profile + /// Connectivity endpoints + /// Identity of the workspace + public Workspace(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), DataLakeStorageAccountDetails defaultDataLakeStorage = default(DataLakeStorageAccountDetails), string sqlAdministratorLoginPassword = default(string), string managedResourceGroupName = default(string), string provisioningState = default(string), string sqlAdministratorLogin = default(string), VirtualNetworkProfile virtualNetworkProfile = default(VirtualNetworkProfile), IDictionary connectivityEndpoints = default(IDictionary), ManagedIdentity identity = default(ManagedIdentity)) + : base(location, id, name, type, tags) + { + DefaultDataLakeStorage = defaultDataLakeStorage; + SqlAdministratorLoginPassword = sqlAdministratorLoginPassword; + ManagedResourceGroupName = managedResourceGroupName; + ProvisioningState = provisioningState; + SqlAdministratorLogin = sqlAdministratorLogin; + VirtualNetworkProfile = virtualNetworkProfile; + ConnectivityEndpoints = connectivityEndpoints; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets workspace default data lake storage account details + /// + [JsonProperty(PropertyName = "properties.defaultDataLakeStorage")] + public DataLakeStorageAccountDetails DefaultDataLakeStorage { get; set; } + + /// + /// Gets or sets SQL administrator login password + /// + [JsonProperty(PropertyName = "properties.sqlAdministratorLoginPassword")] + public string SqlAdministratorLoginPassword { get; set; } + + /// + /// Gets workspace managed resource group + /// + [JsonProperty(PropertyName = "properties.managedResourceGroupName")] + public string ManagedResourceGroupName { get; private set; } + + /// + /// Gets resource provisioning state + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets login for workspace SQL active directory administrator + /// + [JsonProperty(PropertyName = "properties.sqlAdministratorLogin")] + public string SqlAdministratorLogin { get; set; } + + /// + /// Gets or sets virtual Network profile + /// + [JsonProperty(PropertyName = "properties.virtualNetworkProfile")] + public VirtualNetworkProfile VirtualNetworkProfile { get; set; } + + /// + /// Gets or sets connectivity endpoints + /// + [JsonProperty(PropertyName = "properties.connectivityEndpoints")] + public IDictionary ConnectivityEndpoints { get; set; } + + /// + /// Gets or sets identity of the workspace + /// + [JsonProperty(PropertyName = "identity")] + public ManagedIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspaceAadAdminInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspaceAadAdminInfo.cs new file mode 100644 index 000000000000..fef0e28184bc --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspaceAadAdminInfo.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Workspace active directory administrator + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkspaceAadAdminInfo : ProxyResource + { + /// + /// Initializes a new instance of the WorkspaceAadAdminInfo class. + /// + public WorkspaceAadAdminInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceAadAdminInfo 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. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Tenant ID of the workspace active directory + /// administrator + /// Login of the workspace active directory + /// administrator + /// Workspace active directory + /// administrator type + /// Object ID of the workspace active directory + /// administrator + public WorkspaceAadAdminInfo(string id = default(string), string name = default(string), string type = default(string), string tenantId = default(string), string login = default(string), string administratorType = default(string), string sid = default(string)) + : base(id, name, type) + { + TenantId = tenantId; + Login = login; + AdministratorType = administratorType; + Sid = sid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tenant ID of the workspace active directory + /// administrator + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets login of the workspace active directory administrator + /// + [JsonProperty(PropertyName = "properties.login")] + public string Login { get; set; } + + /// + /// Gets or sets workspace active directory administrator type + /// + [JsonProperty(PropertyName = "properties.administratorType")] + public string AdministratorType { get; set; } + + /// + /// Gets or sets object ID of the workspace active directory + /// administrator + /// + [JsonProperty(PropertyName = "properties.sid")] + public string Sid { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspaceInfoListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspaceInfoListResult.cs new file mode 100644 index 000000000000..e3fa962d9a98 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspaceInfoListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of workspaces + /// + public partial class WorkspaceInfoListResult + { + /// + /// Initializes a new instance of the WorkspaceInfoListResult class. + /// + public WorkspaceInfoListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceInfoListResult class. + /// + /// Link to the next page of results + /// List of workspaces + public WorkspaceInfoListResult(string nextLink = default(string), IList value = default(IList)) + { + NextLink = nextLink; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets link to the next page of results + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Gets or sets list of workspaces + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspacePatchInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspacePatchInfo.cs new file mode 100644 index 000000000000..6e834752ae50 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/WorkspacePatchInfo.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Workspace patch details + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkspacePatchInfo + { + /// + /// Initializes a new instance of the WorkspacePatchInfo class. + /// + public WorkspacePatchInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspacePatchInfo class. + /// + /// Resource tags + /// The identity of the workspace + /// SQL administrator login + /// password + /// Resource provisioning state + public WorkspacePatchInfo(IDictionary tags = default(IDictionary), ManagedIdentity identity = default(ManagedIdentity), string sqlAdministratorLoginPassword = default(string), string provisioningState = default(string)) + { + Tags = tags; + Identity = identity; + SqlAdministratorLoginPassword = sqlAdministratorLoginPassword; + ProvisioningState = provisioningState; + 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 identity of the workspace + /// + [JsonProperty(PropertyName = "identity")] + public ManagedIdentity Identity { get; set; } + + /// + /// Gets or sets SQL administrator login password + /// + [JsonProperty(PropertyName = "properties.sqlAdministratorLoginPassword")] + public string SqlAdministratorLoginPassword { get; set; } + + /// + /// Gets resource provisioning state + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Operations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Operations.cs new file mode 100644 index 000000000000..8dccf1bfe2f8 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Operations.cs @@ -0,0 +1,769 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public 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 + /// + public Operations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Check name availability + /// + /// + /// Check whether a workspace name is available + /// + /// + /// The check request + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "request"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("request", request); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability").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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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(request != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(request, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// All operations + /// + /// + /// Get all available 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // 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.Synapse/operations").ToString(); + // 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get operation result + /// + /// + /// Get the result of an operation + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + /// + /// 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 GetLocationHeaderResultWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLocationHeaderResult", 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.Synapse/workspaces/{workspaceName}/operationResults/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 += "?" + 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 (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; + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get operation status + /// + /// + /// Get the status of an operation + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + /// + /// 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> GetAzureAsyncHeaderResultWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAzureAsyncHeaderResult", 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.Synapse/workspaces/{workspaceName}/operationStatuses/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 += "?" + 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 (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; + // 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 != 404 && (int)_statusCode != 500) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 == 500) + { + _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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/OperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..82bde8427133 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/OperationsExtensions.cs @@ -0,0 +1,200 @@ +// +// 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.Synapse +{ + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Check name availability + /// + /// + /// Check whether a workspace name is available + /// + /// + /// The operations group for this extension method. + /// + /// + /// The check request + /// + public static CheckNameAvailabilityResponse CheckNameAvailability(this IOperations operations, CheckNameAvailabilityRequest request) + { + return operations.CheckNameAvailabilityAsync(request).GetAwaiter().GetResult(); + } + + /// + /// Check name availability + /// + /// + /// Check whether a workspace name is available + /// + /// + /// The operations group for this extension method. + /// + /// + /// The check request + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IOperations operations, CheckNameAvailabilityRequest request, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(request, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// All operations + /// + /// + /// Get all available operations + /// + /// + /// The operations group for this extension method. + /// + public static IList List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// All operations + /// + /// + /// Get all available 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; + } + } + + /// + /// Get operation result + /// + /// + /// Get the result of an operation + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + public static void GetLocationHeaderResult(this IOperations operations, string resourceGroupName, string workspaceName, string operationId) + { + operations.GetLocationHeaderResultAsync(resourceGroupName, workspaceName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Get operation result + /// + /// + /// Get the result of an operation + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + /// + /// The cancellation token. + /// + public static async Task GetLocationHeaderResultAsync(this IOperations operations, string resourceGroupName, string workspaceName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GetLocationHeaderResultWithHttpMessagesAsync(resourceGroupName, workspaceName, operationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get operation status + /// + /// + /// Get the status of an operation + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + public static object GetAzureAsyncHeaderResult(this IOperations operations, string resourceGroupName, string workspaceName, string operationId) + { + return operations.GetAzureAsyncHeaderResultAsync(resourceGroupName, workspaceName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Get operation status + /// + /// + /// Get the status of an operation + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Operation ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAzureAsyncHeaderResultAsync(this IOperations operations, string resourceGroupName, string workspaceName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAzureAsyncHeaderResultWithHttpMessagesAsync(resourceGroupName, workspaceName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs new file mode 100644 index 000000000000..2c9911faf131 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs @@ -0,0 +1,52 @@ + +// +// 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.Synapse +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_SynapseManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Synapse", "BigDataPools", "2019-06-01-preview"), + new Tuple("Synapse", "IpFirewallRules", "2019-06-01-preview"), + new Tuple("Synapse", "Operations", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolBlobAuditingPolicies", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolConnectionPolicies", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolDataWarehouseUserActivities", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolGeoBackupPolicies", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolMetadataSyncConfigs", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolOperationResults", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolOperations", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolReplicationLinks", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolRestorePoints", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolSchemas", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolSecurityAlertPolicies", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolSensitivityLabels", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolTableColumns", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolTables", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolTransparentDataEncryptions", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolUsages", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolVulnerabilityAssessmentRuleBaselines", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolVulnerabilityAssessmentScans", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPoolVulnerabilityAssessments", "2019-06-01-preview"), + new Tuple("Synapse", "SqlPools", "2019-06-01-preview"), + new Tuple("Synapse", "WorkspaceAadAdmins", "2019-06-01-preview"), + new Tuple("Synapse", "WorkspaceManagedIdentitySqlControlSettings", "2019-06-01-preview"), + new Tuple("Synapse", "Workspaces", "2019-06-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolBlobAuditingPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolBlobAuditingPolicies.cs new file mode 100644 index 000000000000..7efbbe832b9a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolBlobAuditingPolicies.cs @@ -0,0 +1,502 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolBlobAuditingPolicies operations. + /// + public partial class SqlPoolBlobAuditingPolicies : IServiceOperations, ISqlPoolBlobAuditingPolicies + { + /// + /// Initializes a new instance of the SqlPoolBlobAuditingPolicies class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolBlobAuditingPolicies(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get a SQL pool's blob auditing policy + /// + /// + /// Get a SQL pool's blob auditing policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string blobAuditingPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a SQL pool's blob auditing policy + /// + /// + /// Creates or updates a SQL pool's blob auditing policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The database blob auditing policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolBlobAuditingPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string blobAuditingPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("blobAuditingPolicyName", blobAuditingPolicyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{blobAuditingPolicyName}", System.Uri.EscapeDataString(blobAuditingPolicyName)); + 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 += "?" + 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 (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolBlobAuditingPoliciesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolBlobAuditingPoliciesExtensions.cs new file mode 100644 index 000000000000..37dafe4d3a22 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolBlobAuditingPoliciesExtensions.cs @@ -0,0 +1,133 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolBlobAuditingPolicies. + /// + public static partial class SqlPoolBlobAuditingPoliciesExtensions + { + /// + /// Get a SQL pool's blob auditing policy + /// + /// + /// Get a SQL pool's blob auditing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPoolBlobAuditingPolicy Get(this ISqlPoolBlobAuditingPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get a SQL pool's blob auditing policy + /// + /// + /// Get a SQL pool's blob auditing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolBlobAuditingPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a SQL pool's blob auditing policy + /// + /// + /// Creates or updates a SQL pool's blob auditing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The database blob auditing policy. + /// + public static SqlPoolBlobAuditingPolicy CreateOrUpdate(this ISqlPoolBlobAuditingPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolBlobAuditingPolicy parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, sqlPoolName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a SQL pool's blob auditing policy + /// + /// + /// Creates or updates a SQL pool's blob auditing policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The database blob auditing policy. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlPoolBlobAuditingPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolBlobAuditingPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolConnectionPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolConnectionPolicies.cs new file mode 100644 index 000000000000..2d5eab38d0bf --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolConnectionPolicies.cs @@ -0,0 +1,261 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolConnectionPolicies operations. + /// + public partial class SqlPoolConnectionPolicies : IServiceOperations, ISqlPoolConnectionPolicies + { + /// + /// Initializes a new instance of the SqlPoolConnectionPolicies class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolConnectionPolicies(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get a Sql pool's connection policy, which is used with table auditing + /// + /// + /// Get a Sql pool's connection policy, which is used with table auditing. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string connectionPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("connectionPolicyName", connectionPolicyName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{connectionPolicyName}", System.Uri.EscapeDataString(connectionPolicyName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolConnectionPoliciesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolConnectionPoliciesExtensions.cs new file mode 100644 index 000000000000..54e9f4e64c88 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolConnectionPoliciesExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolConnectionPolicies. + /// + public static partial class SqlPoolConnectionPoliciesExtensions + { + /// + /// Get a Sql pool's connection policy, which is used with table auditing + /// + /// + /// Get a Sql pool's connection policy, which is used with table auditing. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static SqlPoolConnectionPolicy Get(this ISqlPoolConnectionPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get a Sql pool's connection policy, which is used with table auditing + /// + /// + /// Get a Sql pool's connection policy, which is used with table auditing. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task GetAsync(this ISqlPoolConnectionPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolDataWarehouseUserActivities.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolDataWarehouseUserActivities.cs new file mode 100644 index 000000000000..a9973ee5fa2f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolDataWarehouseUserActivities.cs @@ -0,0 +1,261 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolDataWarehouseUserActivities operations. + /// + public partial class SqlPoolDataWarehouseUserActivities : IServiceOperations, ISqlPoolDataWarehouseUserActivities + { + /// + /// Initializes a new instance of the SqlPoolDataWarehouseUserActivities class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolDataWarehouseUserActivities(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get SQL pool user activities + /// + /// + /// Gets the user activities of a SQL pool which includes running and suspended + /// queries + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string dataWarehouseUserActivityName = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("dataWarehouseUserActivityName", dataWarehouseUserActivityName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{dataWarehouseUserActivityName}", System.Uri.EscapeDataString(dataWarehouseUserActivityName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolDataWarehouseUserActivitiesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolDataWarehouseUserActivitiesExtensions.cs new file mode 100644 index 000000000000..ac90eb1325c0 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolDataWarehouseUserActivitiesExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolDataWarehouseUserActivities. + /// + public static partial class SqlPoolDataWarehouseUserActivitiesExtensions + { + /// + /// Get SQL pool user activities + /// + /// + /// Gets the user activities of a SQL pool which includes running and suspended + /// queries + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static DataWarehouseUserActivities Get(this ISqlPoolDataWarehouseUserActivities operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get SQL pool user activities + /// + /// + /// Gets the user activities of a SQL pool which includes running and suspended + /// queries + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolDataWarehouseUserActivities operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolGeoBackupPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolGeoBackupPolicies.cs new file mode 100644 index 000000000000..413f86b9f534 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolGeoBackupPolicies.cs @@ -0,0 +1,260 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolGeoBackupPolicies operations. + /// + public partial class SqlPoolGeoBackupPolicies : IServiceOperations, ISqlPoolGeoBackupPolicies + { + /// + /// Initializes a new instance of the SqlPoolGeoBackupPolicies class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolGeoBackupPolicies(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get a SQL pool geo backup policy + /// + /// + /// Get the specified SQL pool geo backup policy + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string geoBackupPolicyName = "Default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("geoBackupPolicyName", geoBackupPolicyName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{geoBackupPolicyName}", System.Uri.EscapeDataString(geoBackupPolicyName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolGeoBackupPoliciesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolGeoBackupPoliciesExtensions.cs new file mode 100644 index 000000000000..5172d998c428 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolGeoBackupPoliciesExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolGeoBackupPolicies. + /// + public static partial class SqlPoolGeoBackupPoliciesExtensions + { + /// + /// Get a SQL pool geo backup policy + /// + /// + /// Get the specified SQL pool geo backup policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static GeoBackupPolicy Get(this ISqlPoolGeoBackupPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get a SQL pool geo backup policy + /// + /// + /// Get the specified SQL pool geo backup policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolGeoBackupPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolMetadataSyncConfigs.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolMetadataSyncConfigs.cs new file mode 100644 index 000000000000..65af79b9a872 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolMetadataSyncConfigs.cs @@ -0,0 +1,488 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolMetadataSyncConfigs operations. + /// + public partial class SqlPoolMetadataSyncConfigs : IServiceOperations, ISqlPoolMetadataSyncConfigs + { + /// + /// Initializes a new instance of the SqlPoolMetadataSyncConfigs class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolMetadataSyncConfigs(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get SQL pool metadata sync config + /// + /// + /// Get the metadata sync configuration for a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 != 404) + { + var ex = new ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Set SQL pool metadata sync config + /// + /// + /// Set the metadata sync configuration for a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Metadata sync configuration + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, MetadataSyncConfig metadataSyncConfiguration, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (metadataSyncConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadataSyncConfiguration"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("metadataSyncConfiguration", metadataSyncConfiguration); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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(metadataSyncConfiguration != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(metadataSyncConfiguration, 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"); + } + // 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 != 404) + { + var ex = new ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolMetadataSyncConfigsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolMetadataSyncConfigsExtensions.cs new file mode 100644 index 000000000000..ec85127a5e6a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolMetadataSyncConfigsExtensions.cs @@ -0,0 +1,133 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolMetadataSyncConfigs. + /// + public static partial class SqlPoolMetadataSyncConfigsExtensions + { + /// + /// Get SQL pool metadata sync config + /// + /// + /// Get the metadata sync configuration for a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static MetadataSyncConfig Get(this ISqlPoolMetadataSyncConfigs operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get SQL pool metadata sync config + /// + /// + /// Get the metadata sync configuration for a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolMetadataSyncConfigs operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Set SQL pool metadata sync config + /// + /// + /// Set the metadata sync configuration for a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Metadata sync configuration + /// + public static MetadataSyncConfig Create(this ISqlPoolMetadataSyncConfigs operations, string resourceGroupName, string workspaceName, string sqlPoolName, MetadataSyncConfig metadataSyncConfiguration) + { + return operations.CreateAsync(resourceGroupName, workspaceName, sqlPoolName, metadataSyncConfiguration).GetAwaiter().GetResult(); + } + + /// + /// Set SQL pool metadata sync config + /// + /// + /// Set the metadata sync configuration for a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Metadata sync configuration + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlPoolMetadataSyncConfigs operations, string resourceGroupName, string workspaceName, string sqlPoolName, MetadataSyncConfig metadataSyncConfiguration, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, metadataSyncConfiguration, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationResults.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationResults.cs new file mode 100644 index 000000000000..c750c17fac10 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationResults.cs @@ -0,0 +1,266 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolOperationResults operations. + /// + public partial class SqlPoolOperationResults : IServiceOperations, ISqlPoolOperationResults + { + /// + /// Initializes a new instance of the SqlPoolOperationResults class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolOperationResults(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get SQL pool operation status + /// + /// + /// Get the status of a SQL pool operation + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Operation ID + /// + /// + /// 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> GetLocationHeaderResultWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLocationHeaderResult", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationResultsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationResultsExtensions.cs new file mode 100644 index 000000000000..09c9b1e7b59f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationResultsExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolOperationResults. + /// + public static partial class SqlPoolOperationResultsExtensions + { + /// + /// Get SQL pool operation status + /// + /// + /// Get the status of a SQL pool operation + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Operation ID + /// + public static object GetLocationHeaderResult(this ISqlPoolOperationResults operations, string resourceGroupName, string workspaceName, string sqlPoolName, string operationId) + { + return operations.GetLocationHeaderResultAsync(resourceGroupName, workspaceName, sqlPoolName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Get SQL pool operation status + /// + /// + /// Get the status of a SQL pool operation + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Operation ID + /// + /// + /// The cancellation token. + /// + public static async Task GetLocationHeaderResultAsync(this ISqlPoolOperationResults operations, string resourceGroupName, string workspaceName, string sqlPoolName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLocationHeaderResultWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperations.cs new file mode 100644 index 000000000000..4e288d3d76dd --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperations.cs @@ -0,0 +1,257 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolOperations operations. + /// + public partial class SqlPoolOperations : IServiceOperations, ISqlPoolOperations + { + /// + /// Initializes a new instance of the SqlPoolOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets a list of operations performed on the SQL pool + /// + /// + /// Gets a list of operations performed on the SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationsExtensions.cs new file mode 100644 index 000000000000..21713466ac05 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolOperationsExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolOperations. + /// + public static partial class SqlPoolOperationsExtensions + { + /// + /// Gets a list of operations performed on the SQL pool + /// + /// + /// Gets a list of operations performed on the SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPoolBlobAuditingPolicySqlPoolOperationListResult List(this ISqlPoolOperations operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of operations performed on the SQL pool + /// + /// + /// Gets a list of operations performed on the SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolOperations operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolReplicationLinks.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolReplicationLinks.cs new file mode 100644 index 000000000000..6eaeb6303fcd --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolReplicationLinks.cs @@ -0,0 +1,257 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolReplicationLinks operations. + /// + public partial class SqlPoolReplicationLinks : IServiceOperations, ISqlPoolReplicationLinks + { + /// + /// Initializes a new instance of the SqlPoolReplicationLinks class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolReplicationLinks(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get SQL pool replication links + /// + /// + /// Lists a Sql pool's replication links. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolReplicationLinksExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolReplicationLinksExtensions.cs new file mode 100644 index 000000000000..f8af2d07e524 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolReplicationLinksExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolReplicationLinks. + /// + public static partial class SqlPoolReplicationLinksExtensions + { + /// + /// Get SQL pool replication links + /// + /// + /// Lists a Sql pool's replication links. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static ReplicationLinkListResult List(this ISqlPoolReplicationLinks operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get SQL pool replication links + /// + /// + /// Lists a Sql pool's replication links. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolReplicationLinks operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolRestorePoints.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolRestorePoints.cs new file mode 100644 index 000000000000..f695b0813b28 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolRestorePoints.cs @@ -0,0 +1,493 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolRestorePoints operations. + /// + public partial class SqlPoolRestorePoints : IServiceOperations, ISqlPoolRestorePoints + { + /// + /// Initializes a new instance of the SqlPoolRestorePoints class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolRestorePoints(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get SQL pool backup + /// + /// + /// Get SQL pool backup information + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a restore point for a data warehouse. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The definition for creating the restore point of this Sql pool. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, CreateSqlPoolRestorePointDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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"); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolRestorePointsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolRestorePointsExtensions.cs new file mode 100644 index 000000000000..12b428355873 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolRestorePointsExtensions.cs @@ -0,0 +1,127 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolRestorePoints. + /// + public static partial class SqlPoolRestorePointsExtensions + { + /// + /// Get SQL pool backup + /// + /// + /// Get SQL pool backup information + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static RestorePointListResult List(this ISqlPoolRestorePoints operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get SQL pool backup + /// + /// + /// Get SQL pool backup information + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolRestorePoints operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a restore point for a data warehouse. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The definition for creating the restore point of this Sql pool. + /// + public static RestorePoint Create(this ISqlPoolRestorePoints operations, string resourceGroupName, string workspaceName, string sqlPoolName, CreateSqlPoolRestorePointDefinition parameters) + { + return operations.CreateAsync(resourceGroupName, workspaceName, sqlPoolName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a restore point for a data warehouse. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The definition for creating the restore point of this Sql pool. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlPoolRestorePoints operations, string resourceGroupName, string workspaceName, string sqlPoolName, CreateSqlPoolRestorePointDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSchemas.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSchemas.cs new file mode 100644 index 000000000000..cddfc435fd5d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSchemas.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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolSchemas operations. + /// + public partial class SqlPoolSchemas : IServiceOperations, ISqlPoolSchemas + { + /// + /// Initializes a new instance of the SqlPoolSchemas class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolSchemas(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets schemas of a given SQL pool + /// + /// + /// Gets schemas of a given SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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 workspaceName, string sqlPoolName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("filter", filter); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSchemasExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSchemasExtensions.cs new file mode 100644 index 000000000000..5d1d7ae3e603 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSchemasExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolSchemas. + /// + public static partial class SqlPoolSchemasExtensions + { + /// + /// Gets schemas of a given SQL pool + /// + /// + /// Gets schemas of a given SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + public static SqlPoolSchemaListResult List(this ISqlPoolSchemas operations, string resourceGroupName, string workspaceName, string sqlPoolName, string filter = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets schemas of a given SQL pool + /// + /// + /// Gets schemas of a given SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolSchemas operations, string resourceGroupName, string workspaceName, string sqlPoolName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSecurityAlertPolicies.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSecurityAlertPolicies.cs new file mode 100644 index 000000000000..9a810932bd77 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSecurityAlertPolicies.cs @@ -0,0 +1,502 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolSecurityAlertPolicies operations. + /// + public partial class SqlPoolSecurityAlertPolicies : IServiceOperations, ISqlPoolSecurityAlertPolicies + { + /// + /// Initializes a new instance of the SqlPoolSecurityAlertPolicies class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolSecurityAlertPolicies(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get a Sql pool's security alert policy + /// + /// + /// Get a Sql pool's security alert policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string securityAlertPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a Sql pool's security alert policy + /// + /// + /// Create or update a Sql pool's security alert policy. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The Sql pool security alert policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string securityAlertPolicyName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + 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 += "?" + 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 (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSecurityAlertPoliciesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSecurityAlertPoliciesExtensions.cs new file mode 100644 index 000000000000..cf46d799a637 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSecurityAlertPoliciesExtensions.cs @@ -0,0 +1,133 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolSecurityAlertPolicies. + /// + public static partial class SqlPoolSecurityAlertPoliciesExtensions + { + /// + /// Get a Sql pool's security alert policy + /// + /// + /// Get a Sql pool's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPoolSecurityAlertPolicy Get(this ISqlPoolSecurityAlertPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get a Sql pool's security alert policy + /// + /// + /// Get a Sql pool's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolSecurityAlertPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a Sql pool's security alert policy + /// + /// + /// Create or update a Sql pool's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The Sql pool security alert policy. + /// + public static SqlPoolSecurityAlertPolicy CreateOrUpdate(this ISqlPoolSecurityAlertPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolSecurityAlertPolicy parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, sqlPoolName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Sql pool's security alert policy + /// + /// + /// Create or update a Sql pool's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The Sql pool security alert policy. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlPoolSecurityAlertPolicies operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSensitivityLabels.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSensitivityLabels.cs new file mode 100644 index 000000000000..1b35a0b9042b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSensitivityLabels.cs @@ -0,0 +1,1383 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolSensitivityLabels operations. + /// + public partial class SqlPoolSensitivityLabels : IServiceOperations, ISqlPoolSensitivityLabels + { + /// + /// Initializes a new instance of the SqlPoolSensitivityLabels class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolSensitivityLabels(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets SQL pool sensitivity labels + /// + /// + /// Gets SQL pool sensitivity labels. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListCurrentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCurrent", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets sensitivity labels of a given SQL pool + /// + /// + /// Gets sensitivity labels of a given SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Specifies whether to include disabled recommendations or not. + /// + /// + /// An OData query option to indicate how many elements to skip in the + /// collection. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListRecommendedWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListRecommended", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (includeDisabledRecommendations != null) + { + _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the sensitivity label of a given column in a Sql pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The column sensitivity label 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string sensitivityLabelSource = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); + 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 += "?" + 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 (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 the sensitivity label of a given column in a Sql pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + string sensitivityLabelSource = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// 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 EnableRecommendationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + string sensitivityLabelSource = "recommended"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "EnableRecommendation", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Disables sensitivity recommendations on a given column + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// 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 DisableRecommendationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + string sensitivityLabelSource = "recommended"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("sensitivityLabelSource", sensitivityLabelSource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DisableRecommendation", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{sensitivityLabelSource}", System.Uri.EscapeDataString(sensitivityLabelSource)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSensitivityLabelsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSensitivityLabelsExtensions.cs new file mode 100644 index 000000000000..1688bf53031b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolSensitivityLabelsExtensions.cs @@ -0,0 +1,408 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolSensitivityLabels. + /// + public static partial class SqlPoolSensitivityLabelsExtensions + { + /// + /// Gets SQL pool sensitivity labels + /// + /// + /// Gets SQL pool sensitivity labels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + public static SensitivityLabelListResult ListCurrent(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string filter = default(string)) + { + return operations.ListCurrentAsync(resourceGroupName, workspaceName, sqlPoolName, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets SQL pool sensitivity labels + /// + /// + /// Gets SQL pool sensitivity labels. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task ListCurrentAsync(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCurrentWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets sensitivity labels of a given SQL pool + /// + /// + /// Gets sensitivity labels of a given SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Specifies whether to include disabled recommendations or not. + /// + /// + /// An OData query option to indicate how many elements to skip in the + /// collection. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + public static SensitivityLabelListResult ListRecommended(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), string filter = default(string)) + { + return operations.ListRecommendedAsync(resourceGroupName, workspaceName, sqlPoolName, includeDisabledRecommendations, skipToken, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets sensitivity labels of a given SQL pool + /// + /// + /// Gets sensitivity labels of a given SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Specifies whether to include disabled recommendations or not. + /// + /// + /// An OData query option to indicate how many elements to skip in the + /// collection. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task ListRecommendedAsync(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListRecommendedWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, includeDisabledRecommendations, skipToken, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the sensitivity label of a given column in a Sql pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The column sensitivity label resource. + /// + public static SensitivityLabel CreateOrUpdate(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, SensitivityLabel parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the sensitivity label of a given column in a Sql pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The column sensitivity label resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, SensitivityLabel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the sensitivity label of a given column in a Sql pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + public static void Delete(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the sensitivity label of a given column in a Sql pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + public static void EnableRecommendation(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName) + { + operations.EnableRecommendationAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Enables sensitivity recommendations on a given column (recommendations are + /// enabled by default on all columns) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The cancellation token. + /// + public static async Task EnableRecommendationAsync(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.EnableRecommendationWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Disables sensitivity recommendations on a given column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + public static void DisableRecommendation(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName) + { + operations.DisableRecommendationAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Disables sensitivity recommendations on a given column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// The name of the column. + /// + /// + /// The cancellation token. + /// + public static async Task DisableRecommendationAsync(this ISqlPoolSensitivityLabels operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DisableRecommendationWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTableColumns.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTableColumns.cs new file mode 100644 index 000000000000..8576751fef64 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTableColumns.cs @@ -0,0 +1,283 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolTableColumns operations. + /// + public partial class SqlPoolTableColumns : IServiceOperations, ISqlPoolTableColumns + { + /// + /// Initializes a new instance of the SqlPoolTableColumns class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolTableColumns(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets columns in a given table in a SQL pool + /// + /// + /// Gets columns in a given table in a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListByTableNameWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTableName", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTableColumnsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTableColumnsExtensions.cs new file mode 100644 index 000000000000..5a8cd63c7de6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTableColumnsExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolTableColumns. + /// + public static partial class SqlPoolTableColumnsExtensions + { + /// + /// Gets columns in a given table in a SQL pool + /// + /// + /// Gets columns in a given table in a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + public static SqlPoolColumnListResult ListByTableName(this ISqlPoolTableColumns operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string filter = default(string)) + { + return operations.ListByTableNameAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets columns in a given table in a SQL pool + /// + /// + /// Gets columns in a given table in a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// The name of the table. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task ListByTableNameAsync(this ISqlPoolTableColumns operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableNameWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, tableName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTables.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTables.cs new file mode 100644 index 000000000000..7dbf94ca95de --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTables.cs @@ -0,0 +1,274 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolTables operations. + /// + public partial class SqlPoolTables : IServiceOperations, ISqlPoolTables + { + /// + /// Initializes a new instance of the SqlPoolTables class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolTables(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets tables of a given schema in a SQL pool + /// + /// + /// Gets tables of a given schema in a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// 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> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchema", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTablesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTablesExtensions.cs new file mode 100644 index 000000000000..55b9ce7dbe6c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTablesExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolTables. + /// + public static partial class SqlPoolTablesExtensions + { + /// + /// Gets tables of a given schema in a SQL pool + /// + /// + /// Gets tables of a given schema in a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + public static SqlPoolTableListResult ListBySchema(this ISqlPoolTables operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string filter = default(string)) + { + return operations.ListBySchemaAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets tables of a given schema in a SQL pool + /// + /// + /// Gets tables of a given schema in a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The name of the schema. + /// + /// + /// An OData filter expression that filters elements in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task ListBySchemaAsync(this ISqlPoolTables operations, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, schemaName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTransparentDataEncryptions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTransparentDataEncryptions.cs new file mode 100644 index 000000000000..7c4c7c1c3616 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTransparentDataEncryptions.cs @@ -0,0 +1,499 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolTransparentDataEncryptions operations. + /// + public partial class SqlPoolTransparentDataEncryptions : IServiceOperations, ISqlPoolTransparentDataEncryptions + { + /// + /// Initializes a new instance of the SqlPoolTransparentDataEncryptions class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolTransparentDataEncryptions(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get a SQL pool's transparent data encryption configuration + /// + /// + /// Get a SQL pool's transparent data encryption configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string transparentDataEncryptionName = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a Sql pool's transparent data encryption configuration + /// + /// + /// Creates or updates a Sql pool's transparent data encryption configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The required parameters for creating or updating transparent data + /// encryption. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string transparentDataEncryptionName = "current"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("transparentDataEncryptionName", transparentDataEncryptionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{transparentDataEncryptionName}", System.Uri.EscapeDataString(transparentDataEncryptionName)); + 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 += "?" + 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 (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTransparentDataEncryptionsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTransparentDataEncryptionsExtensions.cs new file mode 100644 index 000000000000..fb6e3b1821b5 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolTransparentDataEncryptionsExtensions.cs @@ -0,0 +1,135 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolTransparentDataEncryptions. + /// + public static partial class SqlPoolTransparentDataEncryptionsExtensions + { + /// + /// Get a SQL pool's transparent data encryption configuration + /// + /// + /// Get a SQL pool's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static TransparentDataEncryption Get(this ISqlPoolTransparentDataEncryptions operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get a SQL pool's transparent data encryption configuration + /// + /// + /// Get a SQL pool's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolTransparentDataEncryptions operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Sql pool's transparent data encryption configuration + /// + /// + /// Creates or updates a Sql pool's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The required parameters for creating or updating transparent data + /// encryption. + /// + public static TransparentDataEncryption CreateOrUpdate(this ISqlPoolTransparentDataEncryptions operations, string resourceGroupName, string workspaceName, string sqlPoolName, TransparentDataEncryption parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, sqlPoolName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Sql pool's transparent data encryption configuration + /// + /// + /// Creates or updates a Sql pool's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The required parameters for creating or updating transparent data + /// encryption. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlPoolTransparentDataEncryptions operations, string resourceGroupName, string workspaceName, string sqlPoolName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolUsages.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolUsages.cs new file mode 100644 index 000000000000..b7163f125a61 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolUsages.cs @@ -0,0 +1,257 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolUsages operations. + /// + public partial class SqlPoolUsages : IServiceOperations, ISqlPoolUsages + { + /// + /// Initializes a new instance of the SqlPoolUsages class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolUsages(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets SQL pool usages + /// + /// + /// Gets SQL pool usages. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/usages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolUsagesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolUsagesExtensions.cs new file mode 100644 index 000000000000..8e95fafde3cb --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolUsagesExtensions.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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolUsages. + /// + public static partial class SqlPoolUsagesExtensions + { + /// + /// Gets SQL pool usages + /// + /// + /// Gets SQL pool usages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPoolUsageListResult List(this ISqlPoolUsages operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets SQL pool usages + /// + /// + /// Gets SQL pool usages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolUsages operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentRuleBaselines.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentRuleBaselines.cs new file mode 100644 index 000000000000..2294e041545b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentRuleBaselines.cs @@ -0,0 +1,489 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolVulnerabilityAssessmentRuleBaselines operations. + /// + public partial class SqlPoolVulnerabilityAssessmentRuleBaselines : IServiceOperations, ISqlPoolVulnerabilityAssessmentRuleBaselines + { + /// + /// Initializes a new instance of the SqlPoolVulnerabilityAssessmentRuleBaselines class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolVulnerabilityAssessmentRuleBaselines(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Creates or updates a Sql pool's vulnerability assessment rule baseline. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default implies a + /// baseline on a Sql pool level rule and master for workspace level rule). + /// Possible values include: 'master', 'default' + /// + /// + /// The requested rule baseline 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, SqlPoolVulnerabilityAssessmentRuleBaseline parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("baselineName", baselineName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); + 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 += "?" + 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 (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Removes the database's vulnerability assessment rule baseline. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default implies a + /// baseline on a Sql pool level rule and master for workspace level rule). + /// Possible values include: 'master', 'default' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("baselineName", baselineName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{baselineName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(baselineName, Client.SerializationSettings).Trim('"'))); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentRuleBaselinesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentRuleBaselinesExtensions.cs new file mode 100644 index 000000000000..18234b85de22 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentRuleBaselinesExtensions.cs @@ -0,0 +1,150 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolVulnerabilityAssessmentRuleBaselines. + /// + public static partial class SqlPoolVulnerabilityAssessmentRuleBaselinesExtensions + { + /// + /// Creates or updates a Sql pool's vulnerability assessment rule baseline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default implies a + /// baseline on a Sql pool level rule and master for workspace level rule). + /// Possible values include: 'master', 'default' + /// + /// + /// The requested rule baseline resource. + /// + public static SqlPoolVulnerabilityAssessmentRuleBaseline CreateOrUpdate(this ISqlPoolVulnerabilityAssessmentRuleBaselines operations, string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, SqlPoolVulnerabilityAssessmentRuleBaseline parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, sqlPoolName, ruleId, baselineName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Sql pool's vulnerability assessment rule baseline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default implies a + /// baseline on a Sql pool level rule and master for workspace level rule). + /// Possible values include: 'master', 'default' + /// + /// + /// The requested rule baseline resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlPoolVulnerabilityAssessmentRuleBaselines operations, string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, SqlPoolVulnerabilityAssessmentRuleBaseline parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, ruleId, baselineName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Removes the database's vulnerability assessment rule baseline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default implies a + /// baseline on a Sql pool level rule and master for workspace level rule). + /// Possible values include: 'master', 'default' + /// + public static void Delete(this ISqlPoolVulnerabilityAssessmentRuleBaselines operations, string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, sqlPoolName, ruleId, baselineName).GetAwaiter().GetResult(); + } + + /// + /// Removes the database's vulnerability assessment rule baseline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment rule ID. + /// + /// + /// The name of the vulnerability assessment rule baseline (default implies a + /// baseline on a Sql pool level rule and master for workspace level rule). + /// Possible values include: 'master', 'default' + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlPoolVulnerabilityAssessmentRuleBaselines operations, string resourceGroupName, string workspaceName, string sqlPoolName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, ruleId, baselineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentScans.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentScans.cs new file mode 100644 index 000000000000..12140bfb8f96 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentScans.cs @@ -0,0 +1,682 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolVulnerabilityAssessmentScans operations. + /// + public partial class SqlPoolVulnerabilityAssessmentScans : IServiceOperations, ISqlPoolVulnerabilityAssessmentScans + { + /// + /// Initializes a new instance of the SqlPoolVulnerabilityAssessmentScans class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolVulnerabilityAssessmentScans(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Lists the vulnerability assessment scans of a SQL pool + /// + /// + /// Lists the vulnerability assessment scans of a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Executes a Vulnerability Assessment database scan. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// 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 InitiateScanWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (scanId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("scanId", scanId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "InitiateScan", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Convert an existing scan result to a human readable format. If already + /// exists nothing happens + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// 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> ExportWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (scanId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("scanId", scanId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Export", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentScansExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentScansExtensions.cs new file mode 100644 index 000000000000..3b1c8fbea40f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentScansExtensions.cs @@ -0,0 +1,178 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolVulnerabilityAssessmentScans. + /// + public static partial class SqlPoolVulnerabilityAssessmentScansExtensions + { + /// + /// Lists the vulnerability assessment scans of a SQL pool + /// + /// + /// Lists the vulnerability assessment scans of a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static VulnerabilityAssessmentScanRecordListResult List(this ISqlPoolVulnerabilityAssessmentScans operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Lists the vulnerability assessment scans of a SQL pool + /// + /// + /// Lists the vulnerability assessment scans of a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolVulnerabilityAssessmentScans operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Executes a Vulnerability Assessment database scan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + public static void InitiateScan(this ISqlPoolVulnerabilityAssessmentScans operations, string resourceGroupName, string workspaceName, string sqlPoolName, string scanId) + { + operations.InitiateScanAsync(resourceGroupName, workspaceName, sqlPoolName, scanId).GetAwaiter().GetResult(); + } + + /// + /// Executes a Vulnerability Assessment database scan. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// The cancellation token. + /// + public static async Task InitiateScanAsync(this ISqlPoolVulnerabilityAssessmentScans operations, string resourceGroupName, string workspaceName, string sqlPoolName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Convert an existing scan result to a human readable format. If already + /// exists nothing happens + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + public static SqlPoolVulnerabilityAssessmentScansExport Export(this ISqlPoolVulnerabilityAssessmentScans operations, string resourceGroupName, string workspaceName, string sqlPoolName, string scanId) + { + return operations.ExportAsync(resourceGroupName, workspaceName, sqlPoolName, scanId).GetAwaiter().GetResult(); + } + + /// + /// Convert an existing scan result to a human readable format. If already + /// exists nothing happens + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// The cancellation token. + /// + public static async Task ExportAsync(this ISqlPoolVulnerabilityAssessmentScans operations, string resourceGroupName, string workspaceName, string sqlPoolName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, scanId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessments.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessments.cs new file mode 100644 index 000000000000..95f526f394ff --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessments.cs @@ -0,0 +1,886 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPoolVulnerabilityAssessments operations. + /// + public partial class SqlPoolVulnerabilityAssessments : IServiceOperations, ISqlPoolVulnerabilityAssessments + { + /// + /// Initializes a new instance of the SqlPoolVulnerabilityAssessments class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPoolVulnerabilityAssessments(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Lists the vulnerability assessment policies associated with a SQL pool + /// + /// + /// Lists the vulnerability assessment policies associated with a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the Sql pool's vulnerability assessment + /// + /// + /// Gets the Sql pool's vulnerability assessment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the Sql pool vulnerability assessment + /// + /// + /// Creates or updates the Sql pool vulnerability assessment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The requested 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolVulnerabilityAssessment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + 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 += "?" + 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 (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Removes the database's vulnerability assessment + /// + /// + /// Removes the database's vulnerability assessment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + string vulnerabilityAssessmentName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentsExtensions.cs new file mode 100644 index 000000000000..29abb438dde2 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolVulnerabilityAssessmentsExtensions.cs @@ -0,0 +1,234 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPoolVulnerabilityAssessments. + /// + public static partial class SqlPoolVulnerabilityAssessmentsExtensions + { + /// + /// Lists the vulnerability assessment policies associated with a SQL pool + /// + /// + /// Lists the vulnerability assessment policies associated with a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPoolVulnerabilityAssessmentListResult List(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ListAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Lists the vulnerability assessment policies associated with a SQL pool + /// + /// + /// Lists the vulnerability assessment policies associated with a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the Sql pool's vulnerability assessment + /// + /// + /// Gets the Sql pool's vulnerability assessment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPoolVulnerabilityAssessment Get(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets the Sql pool's vulnerability assessment + /// + /// + /// Gets the Sql pool's vulnerability assessment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the Sql pool vulnerability assessment + /// + /// + /// Creates or updates the Sql pool vulnerability assessment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The requested resource. + /// + public static SqlPoolVulnerabilityAssessment CreateOrUpdate(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolVulnerabilityAssessment parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, sqlPoolName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the Sql pool vulnerability assessment + /// + /// + /// Creates or updates the Sql pool vulnerability assessment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The requested resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolVulnerabilityAssessment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Removes the database's vulnerability assessment + /// + /// + /// Removes the database's vulnerability assessment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static void Delete(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Removes the database's vulnerability assessment + /// + /// + /// Removes the database's vulnerability assessment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlPoolVulnerabilityAssessments operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPools.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPools.cs new file mode 100644 index 000000000000..00da93abebac --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPools.cs @@ -0,0 +1,1730 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlPools operations. + /// + public partial class SqlPools : IServiceOperations, ISqlPools + { + /// + /// Initializes a new instance of the SqlPools class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public SqlPools(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get SQL pool + /// + /// + /// Get SQL pool properties + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update SQL pool + /// + /// + /// Apply a partial update to a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The updated SQL pool properties + /// + /// + /// 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 workspaceName, string sqlPoolName, SqlPoolPatchInfo sqlPoolInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (sqlPoolInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolInfo"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("sqlPoolInfo", sqlPoolInfo); + 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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(sqlPoolInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlPoolInfo, 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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create SQL pool + /// + /// + /// Create a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The SQL pool to create + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, SqlPool sqlPoolInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (sqlPoolInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolInfo"); + } + if (sqlPoolInfo != null) + { + sqlPoolInfo.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("sqlPoolInfo", sqlPoolInfo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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(sqlPoolInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sqlPoolInfo, 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"); + } + // 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 != 404) + { + var ex = new ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Delete SQL pool + /// + /// + /// Delete a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List SQL pools + /// + /// + /// List all SQL pools + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.Synapse/workspaces/{workspaceName}/sqlPools").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Pause SQL pool + /// + /// + /// Pause a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PauseWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Pause", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Resume SQL pool + /// + /// + /// Resume a SQL pool + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Resume", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Rename a SQL pool + /// + /// + /// Rename a SQL pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The resource move definition for renaming this Sql pool. + /// + /// + /// 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 RenameWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string sqlPoolName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (sqlPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("sqlPoolName", sqlPoolName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Rename", 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.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/move").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{sqlPoolName}", System.Uri.EscapeDataString(sqlPoolName)); + 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 += "?" + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (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"); + } + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolsExtensions.cs new file mode 100644 index 000000000000..fc145a91ef21 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SqlPoolsExtensions.cs @@ -0,0 +1,448 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlPools. + /// + public static partial class SqlPoolsExtensions + { + /// + /// Get SQL pool + /// + /// + /// Get SQL pool properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static SqlPool Get(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.GetAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get SQL pool + /// + /// + /// Get SQL pool properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update SQL pool + /// + /// + /// Apply a partial update to a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The updated SQL pool properties + /// + public static SqlPool Update(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolPatchInfo sqlPoolInfo) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, sqlPoolName, sqlPoolInfo).GetAwaiter().GetResult(); + } + + /// + /// Update SQL pool + /// + /// + /// Apply a partial update to a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The updated SQL pool properties + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolPatchInfo sqlPoolInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, sqlPoolInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create SQL pool + /// + /// + /// Create a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The SQL pool to create + /// + public static SqlPool Create(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPool sqlPoolInfo) + { + return operations.CreateAsync(resourceGroupName, workspaceName, sqlPoolName, sqlPoolInfo).GetAwaiter().GetResult(); + } + + /// + /// Create SQL pool + /// + /// + /// Create a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The SQL pool to create + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPool sqlPoolInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, sqlPoolInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete SQL pool + /// + /// + /// Delete a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static object Delete(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.DeleteAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Delete SQL pool + /// + /// + /// Delete a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List SQL pools + /// + /// + /// List all SQL pools + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static SqlPoolInfoListResult ListByWorkspace(this ISqlPools operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// List SQL pools + /// + /// + /// List all SQL pools + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task ListByWorkspaceAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Pause SQL pool + /// + /// + /// Pause a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static object Pause(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.PauseAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Pause SQL pool + /// + /// + /// Pause a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task PauseAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PauseWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Resume SQL pool + /// + /// + /// Resume a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + public static object Resume(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName) + { + return operations.ResumeAsync(resourceGroupName, workspaceName, sqlPoolName).GetAwaiter().GetResult(); + } + + /// + /// Resume SQL pool + /// + /// + /// Resume a SQL pool + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The cancellation token. + /// + public static async Task ResumeAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ResumeWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Rename a SQL pool + /// + /// + /// Rename a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The resource move definition for renaming this Sql pool. + /// + public static void Rename(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, ResourceMoveDefinition parameters) + { + operations.RenameAsync(resourceGroupName, workspaceName, sqlPoolName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Rename a SQL pool + /// + /// + /// Rename a SQL pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// SQL pool name + /// + /// + /// The resource move definition for renaming this Sql pool. + /// + /// + /// The cancellation token. + /// + public static async Task RenameAsync(this ISqlPools operations, string resourceGroupName, string workspaceName, string sqlPoolName, ResourceMoveDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RenameWithHttpMessagesAsync(resourceGroupName, workspaceName, sqlPoolName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs new file mode 100644 index 000000000000..7ae6f84d98ce --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs @@ -0,0 +1,331 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + /// + /// Azure Synapse Analytics Management Client + /// + public partial class SynapseManagementClient : ServiceClient, ISynapseManagementClient + { + /// + /// 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; } + + /// + /// The ID of the target subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; set; } + + /// + /// Gets the IBigDataPools. + /// + public virtual IBigDataPools BigDataPools { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IIpFirewallRules. + /// + public virtual IIpFirewallRules IpFirewallRules { get; private set; } + + /// + /// Gets the ISqlPools. + /// + public virtual ISqlPools SqlPools { get; private set; } + + /// + /// Gets the ISqlPoolMetadataSyncConfigs. + /// + public virtual ISqlPoolMetadataSyncConfigs SqlPoolMetadataSyncConfigs { get; private set; } + + /// + /// Gets the ISqlPoolOperationResults. + /// + public virtual ISqlPoolOperationResults SqlPoolOperationResults { get; private set; } + + /// + /// Gets the ISqlPoolGeoBackupPolicies. + /// + public virtual ISqlPoolGeoBackupPolicies SqlPoolGeoBackupPolicies { get; private set; } + + /// + /// Gets the ISqlPoolDataWarehouseUserActivities. + /// + public virtual ISqlPoolDataWarehouseUserActivities SqlPoolDataWarehouseUserActivities { get; private set; } + + /// + /// Gets the ISqlPoolRestorePoints. + /// + public virtual ISqlPoolRestorePoints SqlPoolRestorePoints { get; private set; } + + /// + /// Gets the ISqlPoolReplicationLinks. + /// + public virtual ISqlPoolReplicationLinks SqlPoolReplicationLinks { get; private set; } + + /// + /// Gets the ISqlPoolTransparentDataEncryptions. + /// + public virtual ISqlPoolTransparentDataEncryptions SqlPoolTransparentDataEncryptions { get; private set; } + + /// + /// Gets the ISqlPoolBlobAuditingPolicies. + /// + public virtual ISqlPoolBlobAuditingPolicies SqlPoolBlobAuditingPolicies { get; private set; } + + /// + /// Gets the ISqlPoolOperations. + /// + public virtual ISqlPoolOperations SqlPoolOperations { get; private set; } + + /// + /// Gets the ISqlPoolUsages. + /// + public virtual ISqlPoolUsages SqlPoolUsages { get; private set; } + + /// + /// Gets the ISqlPoolSensitivityLabels. + /// + public virtual ISqlPoolSensitivityLabels SqlPoolSensitivityLabels { get; private set; } + + /// + /// Gets the ISqlPoolSchemas. + /// + public virtual ISqlPoolSchemas SqlPoolSchemas { get; private set; } + + /// + /// Gets the ISqlPoolTables. + /// + public virtual ISqlPoolTables SqlPoolTables { get; private set; } + + /// + /// Gets the ISqlPoolTableColumns. + /// + public virtual ISqlPoolTableColumns SqlPoolTableColumns { get; private set; } + + /// + /// Gets the ISqlPoolConnectionPolicies. + /// + public virtual ISqlPoolConnectionPolicies SqlPoolConnectionPolicies { get; private set; } + + /// + /// Gets the ISqlPoolVulnerabilityAssessments. + /// + public virtual ISqlPoolVulnerabilityAssessments SqlPoolVulnerabilityAssessments { get; private set; } + + /// + /// Gets the ISqlPoolVulnerabilityAssessmentScans. + /// + public virtual ISqlPoolVulnerabilityAssessmentScans SqlPoolVulnerabilityAssessmentScans { get; private set; } + + /// + /// Gets the ISqlPoolSecurityAlertPolicies. + /// + public virtual ISqlPoolSecurityAlertPolicies SqlPoolSecurityAlertPolicies { get; private set; } + + /// + /// Gets the ISqlPoolVulnerabilityAssessmentRuleBaselines. + /// + public virtual ISqlPoolVulnerabilityAssessmentRuleBaselines SqlPoolVulnerabilityAssessmentRuleBaselines { get; private set; } + + /// + /// Gets the IWorkspaces. + /// + public virtual IWorkspaces Workspaces { get; private set; } + + /// + /// Gets the IWorkspaceAadAdmins. + /// + public virtual IWorkspaceAadAdmins WorkspaceAadAdmins { get; private set; } + + /// + /// Gets the IWorkspaceManagedIdentitySqlControlSettings. + /// + public virtual IWorkspaceManagedIdentitySqlControlSettings WorkspaceManagedIdentitySqlControlSettings { get; private set; } + + /// + /// Initializes a new instance of the SynapseManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SynapseManagementClient.Dispose(). False: will not dispose provided httpClient + public SynapseManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SynapseManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + public SynapseManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SynapseManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + public SynapseManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SynapseManagementClient 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 + /// + public SynapseManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the SynapseManagementClient 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 + /// + public SynapseManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + BigDataPools = new BigDataPools(this); + Operations = new Operations(this); + IpFirewallRules = new IpFirewallRules(this); + SqlPools = new SqlPools(this); + SqlPoolMetadataSyncConfigs = new SqlPoolMetadataSyncConfigs(this); + SqlPoolOperationResults = new SqlPoolOperationResults(this); + SqlPoolGeoBackupPolicies = new SqlPoolGeoBackupPolicies(this); + SqlPoolDataWarehouseUserActivities = new SqlPoolDataWarehouseUserActivities(this); + SqlPoolRestorePoints = new SqlPoolRestorePoints(this); + SqlPoolReplicationLinks = new SqlPoolReplicationLinks(this); + SqlPoolTransparentDataEncryptions = new SqlPoolTransparentDataEncryptions(this); + SqlPoolBlobAuditingPolicies = new SqlPoolBlobAuditingPolicies(this); + SqlPoolOperations = new SqlPoolOperations(this); + SqlPoolUsages = new SqlPoolUsages(this); + SqlPoolSensitivityLabels = new SqlPoolSensitivityLabels(this); + SqlPoolSchemas = new SqlPoolSchemas(this); + SqlPoolTables = new SqlPoolTables(this); + SqlPoolTableColumns = new SqlPoolTableColumns(this); + SqlPoolConnectionPolicies = new SqlPoolConnectionPolicies(this); + SqlPoolVulnerabilityAssessments = new SqlPoolVulnerabilityAssessments(this); + SqlPoolVulnerabilityAssessmentScans = new SqlPoolVulnerabilityAssessmentScans(this); + SqlPoolSecurityAlertPolicies = new SqlPoolSecurityAlertPolicies(this); + SqlPoolVulnerabilityAssessmentRuleBaselines = new SqlPoolVulnerabilityAssessmentRuleBaselines(this); + Workspaces = new Workspaces(this); + WorkspaceAadAdmins = new WorkspaceAadAdmins(this); + WorkspaceManagedIdentitySqlControlSettings = new WorkspaceManagedIdentitySqlControlSettings(this); + BaseUri = new System.Uri("https://management.azure.com"); + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceAadAdmins.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceAadAdmins.cs new file mode 100644 index 000000000000..6cbab892cb42 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceAadAdmins.cs @@ -0,0 +1,652 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceAadAdmins operations. + /// + public partial class WorkspaceAadAdmins : IServiceOperations, IWorkspaceAadAdmins + { + /// + /// Initializes a new instance of the WorkspaceAadAdmins class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public WorkspaceAadAdmins(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Gets a workspace active directory admin + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.Synapse/workspaces/{workspaceName}/administrators/activeDirectory").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a workspace active directory admin + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace active directory administrator properties + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, WorkspaceAadAdminInfo aadAdminInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (aadAdminInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aadAdminInfo"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("aadAdminInfo", aadAdminInfo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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(aadAdminInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(aadAdminInfo, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a workspace active directory admin + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceAadAdminsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceAadAdminsExtensions.cs new file mode 100644 index 000000000000..cb5940ec92dd --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceAadAdminsExtensions.cs @@ -0,0 +1,146 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspaceAadAdmins. + /// + public static partial class WorkspaceAadAdminsExtensions + { + /// + /// Gets a workspace active directory admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static WorkspaceAadAdminInfo Get(this IWorkspaceAadAdmins operations, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a workspace active directory admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspaceAadAdmins operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a workspace active directory admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace active directory administrator properties + /// + public static WorkspaceAadAdminInfo CreateOrUpdate(this IWorkspaceAadAdmins operations, string resourceGroupName, string workspaceName, WorkspaceAadAdminInfo aadAdminInfo) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, aadAdminInfo).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a workspace active directory admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace active directory administrator properties + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkspaceAadAdmins operations, string resourceGroupName, string workspaceName, WorkspaceAadAdminInfo aadAdminInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, aadAdminInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a workspace active directory admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static void Delete(this IWorkspaceAadAdmins operations, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a workspace active directory admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkspaceAadAdmins operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedIdentitySqlControlSettings.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedIdentitySqlControlSettings.cs new file mode 100644 index 000000000000..bbbdfd92df8a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedIdentitySqlControlSettings.cs @@ -0,0 +1,464 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceManagedIdentitySqlControlSettings operations. + /// + public partial class WorkspaceManagedIdentitySqlControlSettings : IServiceOperations, IWorkspaceManagedIdentitySqlControlSettings + { + /// + /// Initializes a new instance of the WorkspaceManagedIdentitySqlControlSettings class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public WorkspaceManagedIdentitySqlControlSettings(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Get Managed Identity Sql Control Settings + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update Managed Identity Sql Control Settings + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Managed Identity Sql Control Settings + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, ManagedIdentitySqlControlSettingsModel managedIdentitySqlControlSettings, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (managedIdentitySqlControlSettings == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedIdentitySqlControlSettings"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("managedIdentitySqlControlSettings", managedIdentitySqlControlSettings); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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(managedIdentitySqlControlSettings != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managedIdentitySqlControlSettings, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedIdentitySqlControlSettingsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedIdentitySqlControlSettingsExtensions.cs new file mode 100644 index 000000000000..83f6d2a590ab --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedIdentitySqlControlSettingsExtensions.cs @@ -0,0 +1,109 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspaceManagedIdentitySqlControlSettings. + /// + public static partial class WorkspaceManagedIdentitySqlControlSettingsExtensions + { + /// + /// Get Managed Identity Sql Control Settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static ManagedIdentitySqlControlSettingsModel Get(this IWorkspaceManagedIdentitySqlControlSettings operations, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get Managed Identity Sql Control Settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspaceManagedIdentitySqlControlSettings operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update Managed Identity Sql Control Settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Managed Identity Sql Control Settings + /// + public static ManagedIdentitySqlControlSettingsModel CreateOrUpdate(this IWorkspaceManagedIdentitySqlControlSettings operations, string resourceGroupName, string workspaceName, ManagedIdentitySqlControlSettingsModel managedIdentitySqlControlSettings) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, managedIdentitySqlControlSettings).GetAwaiter().GetResult(); + } + + /// + /// Create or update Managed Identity Sql Control Settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Managed Identity Sql Control Settings + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkspaceManagedIdentitySqlControlSettings operations, string resourceGroupName, string workspaceName, ManagedIdentitySqlControlSettingsModel managedIdentitySqlControlSettings, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, managedIdentitySqlControlSettings, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Workspaces.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Workspaces.cs new file mode 100644 index 000000000000..fe1a7beac528 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Workspaces.cs @@ -0,0 +1,1272 @@ +// +// 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.Synapse +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Workspaces operations. + /// + public partial class Workspaces : IServiceOperations, IWorkspaces + { + /// + /// Initializes a new instance of the Workspaces class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Workspaces(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Returns a list of workspaces in a resource group + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + // 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.Synapse/workspaces").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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.Synapse/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace patch request properties + /// + /// + /// 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 workspaceName, WorkspacePatchInfo workspacePatchInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspacePatchInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspacePatchInfo"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("workspacePatchInfo", workspacePatchInfo); + 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.Synapse/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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(workspacePatchInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workspacePatchInfo, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Creates or updates a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace create or update request properties + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace workspaceInfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceInfo"); + } + if (workspaceInfo != null) + { + workspaceInfo.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("workspaceInfo", workspaceInfo); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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(workspaceInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workspaceInfo, 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"); + } + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 += "?" + 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 (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; + // 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 ErrorContractException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorContract _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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of workspaces in a 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.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces").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 += "?" + 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 (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; + // 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspacesExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspacesExtensions.cs new file mode 100644 index 000000000000..04a93aff8848 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspacesExtensions.cs @@ -0,0 +1,257 @@ +// +// 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.Synapse +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Workspaces. + /// + public static partial class WorkspacesExtensions + { + /// + /// Returns a list of workspaces in a resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static WorkspaceInfoListResult ListByResourceGroup(this IWorkspaces operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of workspaces in a resource group + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task ListByResourceGroupAsync(this IWorkspaces operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static Workspace Get(this IWorkspaces operations, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspaces operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace patch request properties + /// + public static Workspace Update(this IWorkspaces operations, string resourceGroupName, string workspaceName, WorkspacePatchInfo workspacePatchInfo) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, workspacePatchInfo).GetAwaiter().GetResult(); + } + + /// + /// Updates a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace patch request properties + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IWorkspaces operations, string resourceGroupName, string workspaceName, WorkspacePatchInfo workspacePatchInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspacePatchInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace create or update request properties + /// + public static Workspace CreateOrUpdate(this IWorkspaces operations, string resourceGroupName, string workspaceName, Workspace workspaceInfo) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, workspaceInfo).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// Workspace create or update request properties + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkspaces operations, string resourceGroupName, string workspaceName, Workspace workspaceInfo, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, workspaceInfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static object Delete(this IWorkspaces operations, string resourceGroupName, string workspaceName) + { + return operations.DeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkspaces operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of workspaces in a subscription + /// + /// + /// The operations group for this extension method. + /// + public static WorkspaceInfoListResult List(this IWorkspaces operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Returns a list of workspaces in a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IWorkspaces operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}