diff --git a/src/Sql/Sql.Management.Sdk/Generated/DatabaseSchemasOperations.cs b/src/Sql/Sql.Management.Sdk/Generated/DatabaseSchemasOperations.cs new file mode 100644 index 000000000000..2ada1a3cafff --- /dev/null +++ b/src/Sql/Sql.Management.Sdk/Generated/DatabaseSchemasOperations.cs @@ -0,0 +1,674 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Sql +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// DatabaseSchemasOperations operations. + /// + internal partial class DatabaseSchemasOperations : Microsoft.Rest.IServiceOperations, IDatabaseSchemasOperations + { + /// + /// Initializes a new instance of the DatabaseSchemasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseSchemasOperations (SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// List database schemas + /// + /// + /// + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (serverName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serverName"); + } + + if (databaseName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "databaseName"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2024-05-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (odataQuery != null) + { + var _databaseSchema = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_databaseSchema)) + { + _queryParameters.Add(_databaseSchema); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get database schema + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (serverName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serverName"); + } + + if (databaseName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "databaseName"); + } + + if (schemaName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "schemaName"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2024-05-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// List database schemas + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Sql/Sql.Management.Sdk/Generated/DatabaseSchemasOperationsExtensions.cs b/src/Sql/Sql.Management.Sdk/Generated/DatabaseSchemasOperationsExtensions.cs new file mode 100644 index 000000000000..64b8c75c77b1 --- /dev/null +++ b/src/Sql/Sql.Management.Sdk/Generated/DatabaseSchemasOperationsExtensions.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for DatabaseSchemasOperations + /// + public static partial class DatabaseSchemasOperationsExtensions + { + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + public static Microsoft.Rest.Azure.IPage ListByDatabase(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + { + return ((IDatabaseSchemasOperations)operations).ListByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByDatabaseAsync(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get database schema + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + public static DatabaseSchema Get(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName) + { + return ((IDatabaseSchemasOperations)operations).GetAsync(resourceGroupName, serverName, databaseName, schemaName).GetAwaiter().GetResult(); + } + + /// + /// Get database schema + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByDatabaseNext(this IDatabaseSchemasOperations operations, string nextPageLink) + { + return ((IDatabaseSchemasOperations)operations).ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByDatabaseNextAsync(this IDatabaseSchemasOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperations.cs b/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperations.cs index bba6510255af..9abb0d7700b0 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperations.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperations.cs @@ -1031,34 +1031,6 @@ internal DatabasesOperations (SqlManagementClient client) return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Exports a database. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - /// - /// The database export request parameters. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } /// /// Failovers a database. @@ -1089,35 +1061,6 @@ internal DatabasesOperations (SqlManagementClient client) return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Imports a bacpac into a new database. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - /// - /// The database import request parameters. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Renames a database. /// @@ -1846,8 +1789,9 @@ internal DatabasesOperations (SqlManagementClient client) } + /// - /// Creates a new database or updates an existing database. + /// Exports a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1860,7 +1804,62 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the database. /// /// - /// The requested database resource state. + /// The database export request parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Imports a bacpac into a new database. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The database import request parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the database. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. /// /// /// Headers that will be added to request. @@ -1871,9 +1870,6 @@ internal DatabasesOperations (SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1883,20 +1879,12 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -1930,10 +1918,9 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL @@ -1956,7 +1943,7 @@ internal DatabasesOperations (SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -1985,12 +1972,6 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -2013,7 +1994,7 @@ internal DatabasesOperations (SqlManagementClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2048,7 +2029,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2056,42 +2037,6 @@ internal DatabasesOperations (SqlManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -2104,7 +2049,7 @@ internal DatabasesOperations (SqlManagementClient client) } /// - /// Deletes the database. + /// Updates an existing database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2116,6 +2061,9 @@ internal DatabasesOperations (SqlManagementClient client) /// /// The name of the database. /// + /// + /// The requested database resource state. + /// /// /// Headers that will be added to request. /// @@ -2125,6 +2073,9 @@ internal DatabasesOperations (SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -2134,12 +2085,16 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -2173,9 +2128,10 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL @@ -2198,7 +2154,7 @@ internal DatabasesOperations (SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -2227,6 +2183,12 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -2249,7 +2211,7 @@ internal DatabasesOperations (SqlManagementClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2284,7 +2246,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2292,6 +2254,24 @@ internal DatabasesOperations (SqlManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -2304,7 +2284,7 @@ internal DatabasesOperations (SqlManagementClient client) } /// - /// Updates an existing database. + /// Failovers a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2314,10 +2294,10 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to failover. /// - /// - /// The requested database resource state. + /// + /// The type of replica to be failed over. /// /// /// Headers that will be added to request. @@ -2328,9 +2308,6 @@ internal DatabasesOperations (SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -2340,16 +2317,12 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -2365,6 +2338,7 @@ internal DatabasesOperations (SqlManagementClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "databaseName"); } + if (this.Client.SubscriptionId == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -2381,23 +2355,27 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("replicaType", replicaType); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (replicaType != null) + { + _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -2409,7 +2387,7 @@ internal DatabasesOperations (SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -2438,12 +2416,6 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -2501,7 +2473,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2509,24 +2481,6 @@ internal DatabasesOperations (SqlManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -2538,8 +2492,9 @@ internal DatabasesOperations (SqlManagementClient client) } + /// - /// Exports a database. + /// Pauses a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2549,10 +2504,7 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. - /// - /// - /// The database export request parameters. + /// The name of the database to be paused. /// /// /// Headers that will be added to request. @@ -2575,20 +2527,12 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -2622,15 +2566,14 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginPause", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -2677,12 +2620,6 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -2740,7 +2677,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2754,7 +2691,7 @@ internal DatabasesOperations (SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -2778,7 +2715,7 @@ internal DatabasesOperations (SqlManagementClient client) } /// - /// Failovers a database. + /// Resumes a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2788,10 +2725,7 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. + /// The name of the database to be resumed. /// /// /// Headers that will be added to request. @@ -2802,6 +2736,9 @@ internal DatabasesOperations (SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -2811,7 +2748,7 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { @@ -2832,7 +2769,6 @@ internal DatabasesOperations (SqlManagementClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "databaseName"); } - if (this.Client.SubscriptionId == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -2849,27 +2785,22 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("replicaType", replicaType); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (replicaType != null) - { - _queryParameters.Add(string.Format("replicaType={0}", System.Uri.EscapeDataString(replicaType))); - } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -2967,7 +2898,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2975,6 +2906,24 @@ internal DatabasesOperations (SqlManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -2987,7 +2936,7 @@ internal DatabasesOperations (SqlManagementClient client) } /// - /// Imports a bacpac into a new database. + /// Upgrades a data warehouse. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -2997,10 +2946,7 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. - /// - /// - /// The database import request parameters. + /// The name of the database to be upgraded. /// /// /// Headers that will be added to request. @@ -3011,9 +2957,6 @@ internal DatabasesOperations (SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -3023,20 +2966,12 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -3070,15 +3005,14 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpgradeDataWarehouse", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -3125,12 +3059,6 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -3188,7 +3116,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3196,24 +3124,6 @@ internal DatabasesOperations (SqlManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -3226,7 +3136,7 @@ internal DatabasesOperations (SqlManagementClient client) } /// - /// Pauses a database. + /// Creates a new database or updates an existing database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -3236,7 +3146,10 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database. + /// + /// + /// The requested database resource state. /// /// /// Headers that will be added to request. @@ -3259,12 +3172,20 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -3285,7 +3206,7 @@ internal DatabasesOperations (SqlManagementClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2023-02-01-preview"; + string apiVersion = "2024-05-01-preview"; // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3298,14 +3219,15 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginPause", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -3323,7 +3245,7 @@ internal DatabasesOperations (SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -3352,6 +3274,12 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -3374,16 +3302,15 @@ internal DatabasesOperations (SqlManagementClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -3393,10 +3320,6 @@ internal DatabasesOperations (SqlManagementClient client) } ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); @@ -3435,6 +3358,24 @@ internal DatabasesOperations (SqlManagementClient client) throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -3447,7 +3388,7 @@ internal DatabasesOperations (SqlManagementClient client) } /// - /// Resumes a database. + /// Exports a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -3457,7 +3398,10 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database. + /// + /// + /// The database export request parameters. /// /// /// Headers that will be added to request. @@ -3480,12 +3424,20 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -3506,7 +3458,7 @@ internal DatabasesOperations (SqlManagementClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2023-02-01-preview"; + string apiVersion = "2024-05-01-preview"; // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3519,14 +3471,15 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -3573,6 +3526,12 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -3597,14 +3556,13 @@ internal DatabasesOperations (SqlManagementClient client) if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -3614,10 +3572,6 @@ internal DatabasesOperations (SqlManagementClient client) } ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); @@ -3630,7 +3584,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3644,7 +3598,7 @@ internal DatabasesOperations (SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -3667,8 +3621,9 @@ internal DatabasesOperations (SqlManagementClient client) } + /// - /// Upgrades a data warehouse. + /// Imports a bacpac into a new database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -3678,7 +3633,10 @@ internal DatabasesOperations (SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database to be upgraded. + /// The name of the database. + /// + /// + /// The database import request parameters. /// /// /// Headers that will be added to request. @@ -3689,6 +3647,9 @@ internal DatabasesOperations (SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -3698,12 +3659,20 @@ internal DatabasesOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -3724,7 +3693,7 @@ internal DatabasesOperations (SqlManagementClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2023-02-01-preview"; + string apiVersion = "2024-05-01-preview"; // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3737,14 +3706,15 @@ internal DatabasesOperations (SqlManagementClient client) tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpgradeDataWarehouse", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -3791,6 +3761,12 @@ internal DatabasesOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -3815,14 +3791,13 @@ internal DatabasesOperations (SqlManagementClient client) if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -3832,10 +3807,6 @@ internal DatabasesOperations (SqlManagementClient client) } ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); @@ -3848,7 +3819,7 @@ internal DatabasesOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3856,6 +3827,24 @@ internal DatabasesOperations (SqlManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -3867,6 +3856,7 @@ internal DatabasesOperations (SqlManagementClient client) } + /// /// Gets a list of databases. /// diff --git a/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperationsExtensions.cs b/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperationsExtensions.cs index 7ffbad940e9c..1cf8b7ae4a54 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperationsExtensions.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/DatabasesOperationsExtensions.cs @@ -350,53 +350,7 @@ public static Database Update(this IDatabasesOperations operations, string resou return _result.Body; } } - /// - /// Exports a database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - public static ImportExportOperationResult Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) - { - return ((IDatabasesOperations)operations).ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); - } - /// - /// Exports a database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } /// /// Failovers a database. /// @@ -764,8 +718,9 @@ public static Microsoft.Rest.Azure.IPage ListInaccessibleByServer(this return _result.Body; } } + /// - /// Creates a new database or updates an existing database. + /// Exports a database. /// /// /// The operations group for this extension method. @@ -780,13 +735,13 @@ public static Microsoft.Rest.Azure.IPage ListInaccessibleByServer(this /// /// The name of the database. /// - public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters) + public static ImportExportOperationResult Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) { - return ((IDatabasesOperations)operations).BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return ((IDatabasesOperations)operations).ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// - /// Creates a new database or updates an existing database. + /// Exports a database. /// /// /// The operations group for this extension method. @@ -804,13 +759,14 @@ public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// /// Deletes the database. /// @@ -902,8 +858,9 @@ public static Database BeginUpdate(this IDatabasesOperations operations, string return _result.Body; } } + /// - /// Exports a database. + /// Failovers a database. /// /// /// The operations group for this extension method. @@ -916,15 +873,18 @@ public static Database BeginUpdate(this IDatabasesOperations operations, string /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to failover. /// - public static ImportExportOperationResult BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) + /// + /// The type of replica to be failed over. + /// + public static void BeginFailover(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string)) { - return ((IDatabasesOperations)operations).BeginExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + ((IDatabasesOperations)operations).BeginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).GetAwaiter().GetResult(); } /// - /// Exports a database. + /// Failovers a database. /// /// /// The operations group for this extension method. @@ -937,20 +897,21 @@ public static ImportExportOperationResult BeginExport(this IDatabasesOperations /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to failover. + /// + /// + /// The type of replica to be failed over. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginFailoverAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// - /// Failovers a database. + /// Pauses a database. /// /// /// The operations group for this extension method. @@ -963,18 +924,15 @@ public static ImportExportOperationResult BeginExport(this IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. + /// The name of the database to be paused. /// - public static void BeginFailover(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string)) + public static Database BeginPause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - ((IDatabasesOperations)operations).BeginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).GetAwaiter().GetResult(); + return ((IDatabasesOperations)operations).BeginPauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Failovers a database. + /// Pauses a database. /// /// /// The operations group for this extension method. @@ -987,20 +945,20 @@ public static ImportExportOperationResult BeginExport(this IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. + /// The name of the database to be paused. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginFailoverAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginPauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - (await operations.BeginFailoverWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Imports a bacpac into a new database. + /// Resumes a database. /// /// /// The operations group for this extension method. @@ -1013,15 +971,15 @@ public static ImportExportOperationResult BeginExport(this IDatabasesOperations /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to be resumed. /// - public static ImportExportOperationResult BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + public static Database BeginResume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - return ((IDatabasesOperations)operations).BeginImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return ((IDatabasesOperations)operations).BeginResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Imports a bacpac into a new database. + /// Resumes a database. /// /// /// The operations group for this extension method. @@ -1034,20 +992,20 @@ public static ImportExportOperationResult BeginImport(this IDatabasesOperations /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to be resumed. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Pauses a database. + /// Upgrades a data warehouse. /// /// /// The operations group for this extension method. @@ -1060,15 +1018,15 @@ public static ImportExportOperationResult BeginImport(this IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database to be upgraded. /// - public static Database BeginPause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static void BeginUpgradeDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) { - return ((IDatabasesOperations)operations).BeginPauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + ((IDatabasesOperations)operations).BeginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Pauses a database. + /// Creates a new database or updates an existing database. /// /// /// The operations group for this extension method. @@ -1081,20 +1039,42 @@ public static Database BeginPause(this IDatabasesOperations operations, string r /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database. + /// + public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters) + { + return ((IDatabasesOperations)operations).BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new database or updates an existing database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginPauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// - /// Resumes a database. + /// Exports a database. /// /// /// The operations group for this extension method. @@ -1107,15 +1087,15 @@ public static Database BeginPause(this IDatabasesOperations operations, string r /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database. /// - public static Database BeginResume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static ImportExportOperationResult BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) { - return ((IDatabasesOperations)operations).BeginResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return ((IDatabasesOperations)operations).BeginExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// - /// Resumes a database. + /// Exports a database. /// /// /// The operations group for this extension method. @@ -1128,20 +1108,21 @@ public static Database BeginResume(this IDatabasesOperations operations, string /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// - /// Upgrades a data warehouse. + /// Imports a bacpac into a new database. /// /// /// The operations group for this extension method. @@ -1154,11 +1135,38 @@ public static Database BeginResume(this IDatabasesOperations operations, string /// The name of the server. /// /// - /// The name of the database to be upgraded. + /// The name of the database. /// - public static void BeginUpgradeDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static ImportExportOperationResult BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) { - ((IDatabasesOperations)operations).BeginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return ((IDatabasesOperations)operations).BeginImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Imports a bacpac into a new database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/src/Sql/Sql.Management.Sdk/Generated/IDatabaseSchemasOperations.cs b/src/Sql/Sql.Management.Sdk/Generated/IDatabaseSchemasOperations.cs new file mode 100644 index 000000000000..6b9e2ada13d2 --- /dev/null +++ b/src/Sql/Sql.Management.Sdk/Generated/IDatabaseSchemasOperations.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// DatabaseSchemasOperations operations. + /// + public partial interface IDatabaseSchemasOperations + { + /// + /// List database schemas + /// + /// + /// List database schemas + /// + /// + /// + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get database schema + /// + /// + /// Get database schema + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The name of the schema. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List database schemas + /// + /// + /// List database schemas + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Sql/Sql.Management.Sdk/Generated/IDatabasesOperations.cs b/src/Sql/Sql.Management.Sdk/Generated/IDatabasesOperations.cs index 70c2f9783b4e..26ae255f3a6d 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/IDatabasesOperations.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/IDatabasesOperations.cs @@ -139,39 +139,6 @@ public partial interface IDatabasesOperations /// System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Creates a new database or updates an existing database. - /// - /// - /// Creates a new database or updates an existing database. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - /// - /// The requested database resource state. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// /// Deletes the database. /// @@ -232,39 +199,6 @@ public partial interface IDatabasesOperations /// System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Exports a database. - /// - /// - /// Exports a database. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - /// - /// The name of the database. - /// - /// - /// The database export request parameters. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// /// Failovers a database. /// @@ -533,7 +467,40 @@ public partial interface IDatabasesOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Exports a database. + /// + /// + /// Exports a database. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database. + /// + /// + /// The database export request parameters. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Deletes the database. @@ -596,10 +563,10 @@ public partial interface IDatabasesOperations System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Exports a database. + /// Failovers a database. /// /// - /// Exports a database. + /// Failovers a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -609,10 +576,37 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to failover. /// - /// - /// The database export request parameters. + /// + /// The type of replica to be failed over. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Pauses a database. + /// + /// + /// Pauses a database. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + /// + /// The name of the database to be paused. /// /// /// The headers that will be added to request. @@ -626,13 +620,13 @@ public partial interface IDatabasesOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Failovers a database. + /// Resumes a database. /// /// - /// Failovers a database. + /// Resumes a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -642,10 +636,7 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to failover. - /// - /// - /// The type of replica to be failed over. + /// The name of the database to be resumed. /// /// /// The headers that will be added to request. @@ -656,13 +647,16 @@ public partial interface IDatabasesOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task BeginFailoverWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string replicaType = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Imports a bacpac into a new database. + /// Creates a new database or updates an existing database. /// /// - /// Imports a bacpac into a new database. + /// Creates a new database or updates an existing database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -675,7 +669,7 @@ public partial interface IDatabasesOperations /// The name of the database. /// /// - /// The database import request parameters. + /// The requested database resource state. /// /// /// The headers that will be added to request. @@ -689,13 +683,13 @@ public partial interface IDatabasesOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Pauses a database. + /// Exports a database. /// /// - /// Pauses a database. + /// Exports a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -705,7 +699,10 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to be paused. + /// The name of the database. + /// + /// + /// The database export request parameters. /// /// /// The headers that will be added to request. @@ -719,13 +716,13 @@ public partial interface IDatabasesOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Resumes a database. + /// Imports a bacpac into a new database. /// /// - /// Resumes a database. + /// Imports a bacpac into a new database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -735,7 +732,10 @@ public partial interface IDatabasesOperations /// The name of the server. /// /// - /// The name of the database to be resumed. + /// The name of the database. + /// + /// + /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -749,7 +749,7 @@ public partial interface IDatabasesOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Upgrades a data warehouse. diff --git a/src/Sql/Sql.Management.Sdk/Generated/ISqlManagementClient.cs b/src/Sql/Sql.Management.Sdk/Generated/ISqlManagementClient.cs index 1aa176e2caef..980611058e31 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/ISqlManagementClient.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/ISqlManagementClient.cs @@ -529,5 +529,10 @@ public partial interface ISqlManagementClient : System.IDisposable /// IStartStopManagedInstanceSchedulesOperations StartStopManagedInstanceSchedules { get; } + /// + /// Gets the IDatabaseSchemasOperations + /// + IDatabaseSchemasOperations DatabaseSchemas { get; } + } } \ No newline at end of file diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseProperties.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseProperties.cs index de82a71bb610..146291e021e2 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseProperties.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseProperties.cs @@ -145,9 +145,10 @@ public DatabaseProperties() /// Hyperscale database within an elastic pool. /// Possible values include: 'Enabled', 'Disabled' - /// The number of secondary replicas associated with the database that are used - /// to provide high availability. Not applicable to a Hyperscale database - /// within an elastic pool. + /// The number of secondary replicas associated with the Business Critical, + /// Premium, or Hyperscale edition database that are used to provide high + /// availability. Not applicable to a Hyperscale database within an elastic + /// pool. /// /// The secondary type of the database if it is a secondary. Valid values are @@ -515,9 +516,10 @@ public DatabaseProperties() public string ReadScale {get; set; } /// - /// Gets or sets the number of secondary replicas associated with the database - /// that are used to provide high availability. Not applicable to a Hyperscale - /// database within an elastic pool. + /// Gets or sets the number of secondary replicas associated with the Business + /// Critical, Premium, or Hyperscale edition database that are used to provide + /// high availability. Not applicable to a Hyperscale database within an + /// elastic pool. /// [Newtonsoft.Json.JsonProperty(PropertyName = "highAvailabilityReplicaCount")] public int? HighAvailabilityReplicaCount {get; set; } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseSchema.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseSchema.cs new file mode 100644 index 000000000000..e84d68818fce --- /dev/null +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseSchema.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Sql.Models +{ + using System.Linq; + + /// + /// A database schema resource. + /// + public partial class DatabaseSchema : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseSchema class. + /// + public DatabaseSchema() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseSchema class. + /// + + /// Resource ID. + /// + + /// Resource name. + /// + + /// Resource type. + /// + public DatabaseSchema(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(); + + } +} \ No newline at end of file diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdate.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdate.cs index 064a03e49779..f6de49e587a8 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdate.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdate.cs @@ -159,9 +159,10 @@ public DatabaseUpdate() /// Hyperscale database within an elastic pool. /// Possible values include: 'Enabled', 'Disabled' - /// The number of secondary replicas associated with the database that are used - /// to provide high availability. Not applicable to a Hyperscale database - /// within an elastic pool. + /// The number of secondary replicas associated with the Business Critical, + /// Premium, or Hyperscale edition database that are used to provide high + /// availability. Not applicable to a Hyperscale database within an elastic + /// pool. /// /// The name and tier of the SKU. @@ -526,9 +527,10 @@ public DatabaseUpdate() public string ReadScale {get; set; } /// - /// Gets or sets the number of secondary replicas associated with the database - /// that are used to provide high availability. Not applicable to a Hyperscale - /// database within an elastic pool. + /// Gets or sets the number of secondary replicas associated with the Business + /// Critical, Premium, or Hyperscale edition database that are used to provide + /// high availability. Not applicable to a Hyperscale database within an + /// elastic pool. /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.highAvailabilityReplicaCount")] public int? HighAvailabilityReplicaCount {get; set; } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdateProperties.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdateProperties.cs index bd0abb181c84..47d1fa1f423d 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdateProperties.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/DatabaseUpdateProperties.cs @@ -145,9 +145,10 @@ public DatabaseUpdateProperties() /// Hyperscale database within an elastic pool. /// Possible values include: 'Enabled', 'Disabled' - /// The number of secondary replicas associated with the database that are used - /// to provide high availability. Not applicable to a Hyperscale database - /// within an elastic pool. + /// The number of secondary replicas associated with the Business Critical, + /// Premium, or Hyperscale edition database that are used to provide high + /// availability. Not applicable to a Hyperscale database within an elastic + /// pool. /// /// The secondary type of the database if it is a secondary. Valid values are @@ -488,9 +489,10 @@ public DatabaseUpdateProperties() public string ReadScale {get; set; } /// - /// Gets or sets the number of secondary replicas associated with the database - /// that are used to provide high availability. Not applicable to a Hyperscale - /// database within an elastic pool. + /// Gets or sets the number of secondary replicas associated with the Business + /// Critical, Premium, or Hyperscale edition database that are used to provide + /// high availability. Not applicable to a Hyperscale database within an + /// elastic pool. /// [Newtonsoft.Json.JsonProperty(PropertyName = "highAvailabilityReplicaCount")] public int? HighAvailabilityReplicaCount {get; set; } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/ExportDatabaseDefinition.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/ExportDatabaseDefinition.cs index 8c80a9f7567a..a9f93d0a4a37 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/ExportDatabaseDefinition.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/ExportDatabaseDefinition.cs @@ -24,27 +24,32 @@ public ExportDatabaseDefinition() /// Initializes a new instance of the ExportDatabaseDefinition class. /// - /// Storage key type. - /// Possible values include: 'SharedAccessKey', 'StorageAccessKey' + /// Storage key type: StorageAccessKey, SharedAccessKey, or ManagedIdentity. + /// Possible values include: 'SharedAccessKey', 'StorageAccessKey', + /// 'ManagedIdentity' - /// Storage key. + /// Storage key for the storage account. If StorageKeyType is ManagedIdentity, + /// this field should specify the Managed Identity's resource ID. /// /// Storage Uri. /// - /// Administrator login name. + /// Administrator login name. If AuthenticationType is ManagedIdentity, this + /// field should specify the Managed Identity's resource ID. /// - /// Administrator login password. + /// Administrator login password. If AuthenticationType is ManagedIdentity, + /// this field should not be specified. /// - /// Authentication type. + /// Type of credentials provided for access to the target SQL server: SQL, + /// ADPassword or ManagedIdentity. /// /// Optional resource information to enable network isolation for request. /// - public ExportDatabaseDefinition(string storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword, string authenticationType = default(string), NetworkIsolationSettings networkIsolation = default(NetworkIsolationSettings)) + public ExportDatabaseDefinition(string storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword = default(string), string authenticationType = default(string), NetworkIsolationSettings networkIsolation = default(NetworkIsolationSettings)) { this.StorageKeyType = storageKeyType; @@ -64,13 +69,16 @@ public ExportDatabaseDefinition() /// - /// Gets or sets storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' + /// Gets or sets storage key type: StorageAccessKey, SharedAccessKey, or + /// ManagedIdentity. Possible values include: 'SharedAccessKey', 'StorageAccessKey', 'ManagedIdentity' /// [Newtonsoft.Json.JsonProperty(PropertyName = "storageKeyType")] public string StorageKeyType {get; set; } /// - /// Gets or sets storage key. + /// Gets or sets storage key for the storage account. If StorageKeyType is + /// ManagedIdentity, this field should specify the Managed Identity's resource + /// ID. /// [Newtonsoft.Json.JsonProperty(PropertyName = "storageKey")] public string StorageKey {get; set; } @@ -82,19 +90,23 @@ public ExportDatabaseDefinition() public string StorageUri {get; set; } /// - /// Gets or sets administrator login name. + /// Gets or sets administrator login name. If AuthenticationType is + /// ManagedIdentity, this field should specify the Managed Identity's resource + /// ID. /// [Newtonsoft.Json.JsonProperty(PropertyName = "administratorLogin")] public string AdministratorLogin {get; set; } /// - /// Gets or sets administrator login password. + /// Gets or sets administrator login password. If AuthenticationType is + /// ManagedIdentity, this field should not be specified. /// [Newtonsoft.Json.JsonProperty(PropertyName = "administratorLoginPassword")] public string AdministratorLoginPassword {get; set; } /// - /// Gets or sets authentication type. + /// Gets or sets type of credentials provided for access to the target SQL + /// server: SQL, ADPassword or ManagedIdentity. /// [Newtonsoft.Json.JsonProperty(PropertyName = "authenticationType")] public string AuthenticationType {get; set; } @@ -129,10 +141,6 @@ public virtual void Validate() { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AdministratorLogin"); } - if (this.AdministratorLoginPassword == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AdministratorLoginPassword"); - } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/ImportExistingDatabaseDefinition.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/ImportExistingDatabaseDefinition.cs index f4b0b13cf18f..52d3ce363f1e 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/ImportExistingDatabaseDefinition.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/ImportExistingDatabaseDefinition.cs @@ -25,27 +25,32 @@ public ImportExistingDatabaseDefinition() /// Initializes a new instance of the ImportExistingDatabaseDefinition class. /// - /// Storage key type. - /// Possible values include: 'SharedAccessKey', 'StorageAccessKey' + /// Storage key type: StorageAccessKey, SharedAccessKey, or ManagedIdentity. + /// Possible values include: 'SharedAccessKey', 'StorageAccessKey', + /// 'ManagedIdentity' - /// Storage key. + /// Storage key for the storage account. If StorageKeyType is ManagedIdentity, + /// this field should specify the Managed Identity's resource ID. /// /// Storage Uri. /// - /// Administrator login name. + /// Administrator login name. If AuthenticationType is ManagedIdentity, this + /// field should specify the Managed Identity's resource ID. /// - /// Administrator login password. + /// Administrator login password. If AuthenticationType is ManagedIdentity, + /// this field should not be specified. /// - /// Authentication type. + /// Type of credentials provided for access to the target SQL server: SQL, + /// ADPassword or ManagedIdentity. /// /// Optional resource information to enable network isolation for request. /// - public ImportExistingDatabaseDefinition(string storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword, string authenticationType = default(string), NetworkIsolationSettings networkIsolation = default(NetworkIsolationSettings)) + public ImportExistingDatabaseDefinition(string storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword = default(string), string authenticationType = default(string), NetworkIsolationSettings networkIsolation = default(NetworkIsolationSettings)) { this.StorageKeyType = storageKeyType; @@ -65,13 +70,16 @@ public ImportExistingDatabaseDefinition() /// - /// Gets or sets storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' + /// Gets or sets storage key type: StorageAccessKey, SharedAccessKey, or + /// ManagedIdentity. Possible values include: 'SharedAccessKey', 'StorageAccessKey', 'ManagedIdentity' /// [Newtonsoft.Json.JsonProperty(PropertyName = "storageKeyType")] public string StorageKeyType {get; set; } /// - /// Gets or sets storage key. + /// Gets or sets storage key for the storage account. If StorageKeyType is + /// ManagedIdentity, this field should specify the Managed Identity's resource + /// ID. /// [Newtonsoft.Json.JsonProperty(PropertyName = "storageKey")] public string StorageKey {get; set; } @@ -83,19 +91,23 @@ public ImportExistingDatabaseDefinition() public string StorageUri {get; set; } /// - /// Gets or sets administrator login name. + /// Gets or sets administrator login name. If AuthenticationType is + /// ManagedIdentity, this field should specify the Managed Identity's resource + /// ID. /// [Newtonsoft.Json.JsonProperty(PropertyName = "administratorLogin")] public string AdministratorLogin {get; set; } /// - /// Gets or sets administrator login password. + /// Gets or sets administrator login password. If AuthenticationType is + /// ManagedIdentity, this field should not be specified. /// [Newtonsoft.Json.JsonProperty(PropertyName = "administratorLoginPassword")] public string AdministratorLoginPassword {get; set; } /// - /// Gets or sets authentication type. + /// Gets or sets type of credentials provided for access to the target SQL + /// server: SQL, ADPassword or ManagedIdentity. /// [Newtonsoft.Json.JsonProperty(PropertyName = "authenticationType")] public string AuthenticationType {get; set; } @@ -130,10 +142,6 @@ public virtual void Validate() { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AdministratorLogin"); } - if (this.AdministratorLoginPassword == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AdministratorLoginPassword"); - } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/ImportNewDatabaseDefinition.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/ImportNewDatabaseDefinition.cs index 41105c6e765c..a32720d7fa95 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/ImportNewDatabaseDefinition.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/ImportNewDatabaseDefinition.cs @@ -37,27 +37,32 @@ public ImportNewDatabaseDefinition() /// Max size in bytes for the import database. /// - /// Storage key type. - /// Possible values include: 'SharedAccessKey', 'StorageAccessKey' + /// Storage key type: StorageAccessKey, SharedAccessKey, or ManagedIdentity. + /// Possible values include: 'SharedAccessKey', 'StorageAccessKey', + /// 'ManagedIdentity' - /// Storage key. + /// Storage key for the storage account. If StorageKeyType is ManagedIdentity, + /// this field should specify the Managed Identity's resource ID. /// /// Storage Uri. /// - /// Administrator login name. + /// Administrator login name. If AuthenticationType is ManagedIdentity, this + /// field should specify the Managed Identity's resource ID. /// - /// Administrator login password. + /// Administrator login password. If AuthenticationType is ManagedIdentity, + /// this field should not be specified. /// - /// Authentication type. + /// Type of credentials provided for access to the target SQL server: SQL, + /// ADPassword or ManagedIdentity. /// /// Optional resource information to enable network isolation for request. /// - public ImportNewDatabaseDefinition(string storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword, string databaseName = default(string), string edition = default(string), string serviceObjectiveName = default(string), string maxSizeBytes = default(string), string authenticationType = default(string), NetworkIsolationSettings networkIsolation = default(NetworkIsolationSettings)) + public ImportNewDatabaseDefinition(string storageKeyType, string storageKey, string storageUri, string administratorLogin, string databaseName = default(string), string edition = default(string), string serviceObjectiveName = default(string), string maxSizeBytes = default(string), string administratorLoginPassword = default(string), string authenticationType = default(string), NetworkIsolationSettings networkIsolation = default(NetworkIsolationSettings)) { this.DatabaseName = databaseName; @@ -105,13 +110,16 @@ public ImportNewDatabaseDefinition() public string MaxSizeBytes {get; set; } /// - /// Gets or sets storage key type. Possible values include: 'SharedAccessKey', 'StorageAccessKey' + /// Gets or sets storage key type: StorageAccessKey, SharedAccessKey, or + /// ManagedIdentity. Possible values include: 'SharedAccessKey', 'StorageAccessKey', 'ManagedIdentity' /// [Newtonsoft.Json.JsonProperty(PropertyName = "storageKeyType")] public string StorageKeyType {get; set; } /// - /// Gets or sets storage key. + /// Gets or sets storage key for the storage account. If StorageKeyType is + /// ManagedIdentity, this field should specify the Managed Identity's resource + /// ID. /// [Newtonsoft.Json.JsonProperty(PropertyName = "storageKey")] public string StorageKey {get; set; } @@ -123,19 +131,23 @@ public ImportNewDatabaseDefinition() public string StorageUri {get; set; } /// - /// Gets or sets administrator login name. + /// Gets or sets administrator login name. If AuthenticationType is + /// ManagedIdentity, this field should specify the Managed Identity's resource + /// ID. /// [Newtonsoft.Json.JsonProperty(PropertyName = "administratorLogin")] public string AdministratorLogin {get; set; } /// - /// Gets or sets administrator login password. + /// Gets or sets administrator login password. If AuthenticationType is + /// ManagedIdentity, this field should not be specified. /// [Newtonsoft.Json.JsonProperty(PropertyName = "administratorLoginPassword")] public string AdministratorLoginPassword {get; set; } /// - /// Gets or sets authentication type. + /// Gets or sets type of credentials provided for access to the target SQL + /// server: SQL, ADPassword or ManagedIdentity. /// [Newtonsoft.Json.JsonProperty(PropertyName = "authenticationType")] public string AuthenticationType {get; set; } @@ -170,10 +182,6 @@ public virtual void Validate() { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AdministratorLogin"); } - if (this.AdministratorLoginPassword == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AdministratorLoginPassword"); - } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/MinimalTlsVersion.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/MinimalTlsVersion.cs new file mode 100644 index 000000000000..9cbc228fb5c4 --- /dev/null +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/MinimalTlsVersion.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.Sql.Models +{ + + /// + /// Defines values for MinimalTlsVersion. + /// + + + public static class MinimalTlsVersion + { + public const string None = "None"; + public const string One0 = "1.0"; + public const string One1 = "1.1"; + public const string One2 = "1.2"; + public const string One3 = "1.3"; + } +} \ No newline at end of file diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/Server.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/Server.cs index 8332bc113e51..afb19477d3c9 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/Server.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/Server.cs @@ -64,8 +64,8 @@ public Server() /// List of private endpoint connections on a server /// - /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' - /// + /// Minimal TLS version. Allowed values: 'None', 1.0', '1.1', '1.2', '1.3' + /// Possible values include: 'None', '1.0', '1.1', '1.2', '1.3' /// Whether or not public endpoint access is allowed for this server. Value is /// optional but if passed in, must be 'Enabled' or 'Disabled' or @@ -184,8 +184,8 @@ public Server() public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } /// - /// Gets or sets minimal TLS version. Allowed values: 'None', '1.0', '1.1', - /// '1.2' + /// Gets or sets minimal TLS version. Allowed values: 'None', 1.0', '1.1', + /// '1.2', '1.3' Possible values include: 'None', '1.0', '1.1', '1.2', '1.3' /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.minimalTlsVersion")] public string MinimalTlsVersion {get; set; } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/ServerProperties.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/ServerProperties.cs index c00024d51082..258f6d5f9f2c 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/ServerProperties.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/ServerProperties.cs @@ -42,8 +42,8 @@ public ServerProperties() /// List of private endpoint connections on a server /// - /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' - /// + /// Minimal TLS version. Allowed values: 'None', 1.0', '1.1', '1.2', '1.3' + /// Possible values include: 'None', '1.0', '1.1', '1.2', '1.3' /// Whether or not public endpoint access is allowed for this server. Value is /// optional but if passed in, must be 'Enabled' or 'Disabled' or @@ -146,8 +146,8 @@ public ServerProperties() public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } /// - /// Gets or sets minimal TLS version. Allowed values: 'None', '1.0', '1.1', - /// '1.2' + /// Gets or sets minimal TLS version. Allowed values: 'None', 1.0', '1.1', + /// '1.2', '1.3' Possible values include: 'None', '1.0', '1.1', '1.2', '1.3' /// [Newtonsoft.Json.JsonProperty(PropertyName = "minimalTlsVersion")] public string MinimalTlsVersion {get; set; } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/ServerUpdate.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/ServerUpdate.cs index a75538242b4d..f659fa7822e7 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/ServerUpdate.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/ServerUpdate.cs @@ -49,8 +49,8 @@ public ServerUpdate() /// List of private endpoint connections on a server /// - /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' - /// + /// Minimal TLS version. Allowed values: 'None', 1.0', '1.1', '1.2', '1.3' + /// Possible values include: 'None', '1.0', '1.1', '1.2', '1.3' /// Whether or not public endpoint access is allowed for this server. Value is /// optional but if passed in, must be 'Enabled' or 'Disabled' or @@ -167,8 +167,8 @@ public ServerUpdate() public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } /// - /// Gets or sets minimal TLS version. Allowed values: 'None', '1.0', '1.1', - /// '1.2' + /// Gets or sets minimal TLS version. Allowed values: 'None', 1.0', '1.1', + /// '1.2', '1.3' Possible values include: 'None', '1.0', '1.1', '1.2', '1.3' /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.minimalTlsVersion")] public string MinimalTlsVersion {get; set; } diff --git a/src/Sql/Sql.Management.Sdk/Generated/Models/StorageKeyType.cs b/src/Sql/Sql.Management.Sdk/Generated/Models/StorageKeyType.cs index 63a21f02d393..03952024209f 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/Models/StorageKeyType.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/Models/StorageKeyType.cs @@ -15,5 +15,6 @@ public static class StorageKeyType { public const string SharedAccessKey = "SharedAccessKey"; public const string StorageAccessKey = "StorageAccessKey"; + public const string ManagedIdentity = "ManagedIdentity"; } } \ No newline at end of file diff --git a/src/Sql/Sql.Management.Sdk/Generated/ServersOperations.cs b/src/Sql/Sql.Management.Sdk/Generated/ServersOperations.cs index 02047ad67108..4f3475e9762c 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/ServersOperations.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/ServersOperations.cs @@ -1662,7 +1662,7 @@ internal ServersOperations (SqlManagementClient client) } /// - /// Imports a bacpac into a new database. + /// Refresh external governance enablement status. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1671,9 +1671,6 @@ internal ServersOperations (SqlManagementClient client) /// /// The name of the server. /// - /// - /// The database import request parameters. - /// /// /// Headers that will be added to request. /// @@ -1695,20 +1692,12 @@ internal ServersOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginRefreshStatusWithHttpMessagesAsync(string resourceGroupName, string serverName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -1736,15 +1725,14 @@ internal ServersOperations (SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginImportDatabase", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshStatus", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); @@ -1790,12 +1778,6 @@ internal ServersOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -1853,7 +1835,7 @@ internal ServersOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -1867,7 +1849,7 @@ internal ServersOperations (SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -1891,7 +1873,7 @@ internal ServersOperations (SqlManagementClient client) } /// - /// Refresh external governance enablement status. + /// Imports a bacpac into a new database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -1900,6 +1882,9 @@ internal ServersOperations (SqlManagementClient client) /// /// The name of the server. /// + /// + /// The database import request parameters. + /// /// /// Headers that will be added to request. /// @@ -1921,12 +1906,20 @@ internal ServersOperations (SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginRefreshStatusWithHttpMessagesAsync(string resourceGroupName, string serverName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -1942,7 +1935,7 @@ internal ServersOperations (SqlManagementClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2023-02-01-preview"; + string apiVersion = "2024-05-01-preview"; // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1954,14 +1947,15 @@ internal ServersOperations (SqlManagementClient client) tracingParameters.Add("serverName", serverName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshStatus", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginImportDatabase", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); @@ -2007,6 +2001,12 @@ internal ServersOperations (SqlManagementClient client) } // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -2031,14 +2031,13 @@ internal ServersOperations (SqlManagementClient client) if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2048,10 +2047,6 @@ internal ServersOperations (SqlManagementClient client) } ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); @@ -2064,7 +2059,7 @@ internal ServersOperations (SqlManagementClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2078,7 +2073,7 @@ internal ServersOperations (SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -2101,6 +2096,7 @@ internal ServersOperations (SqlManagementClient client) } + /// /// Gets a list of all servers in the subscription. /// diff --git a/src/Sql/Sql.Management.Sdk/Generated/ServersOperationsExtensions.cs b/src/Sql/Sql.Management.Sdk/Generated/ServersOperationsExtensions.cs index d10b18f3060e..3d2072de4450 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/ServersOperationsExtensions.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/ServersOperationsExtensions.cs @@ -280,8 +280,9 @@ public static Server Update(this IServersOperations operations, string resourceG return _result.Body; } } + /// - /// Imports a bacpac into a new database. + /// Refresh external governance enablement status. /// /// /// The operations group for this extension method. @@ -293,9 +294,9 @@ public static Server Update(this IServersOperations operations, string resourceG /// /// The name of the server. /// - public static ImportExportOperationResult ImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) + public static RefreshExternalGovernanceStatusOperationResult RefreshStatus(this IServersOperations operations, string resourceGroupName, string serverName) { - return ((IServersOperations)operations).ImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + return ((IServersOperations)operations).RefreshStatusAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// @@ -311,18 +312,13 @@ public static ImportExportOperationResult ImportDatabase(this IServersOperations /// /// The name of the server. /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task ImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static ImportExportOperationResult ImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) { - using (var _result = await operations.ImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return ((IServersOperations)operations).ImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } + /// - /// Refresh external governance enablement status. + /// Imports a bacpac into a new database. /// /// /// The operations group for this extension method. @@ -334,9 +330,15 @@ public static ImportExportOperationResult ImportDatabase(this IServersOperations /// /// The name of the server. /// - public static RefreshExternalGovernanceStatusOperationResult RefreshStatus(this IServersOperations operations, string resourceGroupName, string serverName) + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - return ((IServersOperations)operations).RefreshStatusAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + using (var _result = await operations.ImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -482,8 +484,9 @@ public static Server BeginUpdate(this IServersOperations operations, string reso return _result.Body; } } + /// - /// Imports a bacpac into a new database. + /// Refresh external governance enablement status. /// /// /// The operations group for this extension method. @@ -495,9 +498,9 @@ public static Server BeginUpdate(this IServersOperations operations, string reso /// /// The name of the server. /// - public static ImportExportOperationResult BeginImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) + public static RefreshExternalGovernanceStatusOperationResult BeginRefreshStatus(this IServersOperations operations, string resourceGroupName, string serverName) { - return ((IServersOperations)operations).BeginImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + return ((IServersOperations)operations).BeginRefreshStatusAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// @@ -513,18 +516,13 @@ public static ImportExportOperationResult BeginImportDatabase(this IServersOpera /// /// The name of the server. /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task BeginImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static ImportExportOperationResult BeginImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) { - using (var _result = await operations.BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return ((IServersOperations)operations).BeginImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } + /// - /// Refresh external governance enablement status. + /// Imports a bacpac into a new database. /// /// /// The operations group for this extension method. @@ -536,9 +534,15 @@ public static ImportExportOperationResult BeginImportDatabase(this IServersOpera /// /// The name of the server. /// - public static RefreshExternalGovernanceStatusOperationResult BeginRefreshStatus(this IServersOperations operations, string resourceGroupName, string serverName) + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - return ((IServersOperations)operations).BeginRefreshStatusAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + using (var _result = await operations.BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/src/Sql/Sql.Management.Sdk/Generated/SqlManagementClient.cs b/src/Sql/Sql.Management.Sdk/Generated/SqlManagementClient.cs index a5bfb78d8cb9..8785b23e9b56 100644 --- a/src/Sql/Sql.Management.Sdk/Generated/SqlManagementClient.cs +++ b/src/Sql/Sql.Management.Sdk/Generated/SqlManagementClient.cs @@ -430,6 +430,10 @@ public partial class SqlManagementClient : Microsoft.Rest.ServiceClient public virtual IStartStopManagedInstanceSchedulesOperations StartStopManagedInstanceSchedules { get; private set; } /// + /// Gets the IDatabaseSchemasOperations + /// + public virtual IDatabaseSchemasOperations DatabaseSchemas { get; private set; } + /// /// Initializes a new instance of the SqlManagementClient class. /// /// @@ -633,6 +637,9 @@ public SqlManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCrede /// /// 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 /// @@ -757,6 +764,7 @@ private void Initialize() this.ManagedDatabaseMoveOperations = new ManagedDatabaseMoveOperations(this); this.ManagedInstances = new ManagedInstancesOperations(this); this.StartStopManagedInstanceSchedules = new StartStopManagedInstanceSchedulesOperations(this); + this.DatabaseSchemas = new DatabaseSchemasOperations(this); this.BaseUri = new System.Uri("https://management.azure.com"); this.AcceptLanguage = "en-US"; this.LongRunningOperationRetryTimeout = 30; diff --git a/src/Sql/Sql.Management.Sdk/README.md b/src/Sql/Sql.Management.Sdk/README.md index bb4828ac721d..8cb4a5be5f7b 100644 --- a/src/Sql/Sql.Management.Sdk/README.md +++ b/src/Sql/Sql.Management.Sdk/README.md @@ -26,7 +26,7 @@ use-extension: ### ``` yaml -commit: a21edd5a33e0db83bde8d1dfe706a0cf3db6409e +commit: 40923289b489ac3f2a96d274ca5fbf0e4457e5d4 input-file: - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/metrics.json - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/sql.core_legacy.json @@ -117,6 +117,9 @@ input-file: - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/ManagedDatabaseMoveOperations.json - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/ManagedInstances.json - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/StartStopManagedInstanceSchedules.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2024-05-01-preview/DatabaseSchemas.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2024-05-01-preview/Databases.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/sql/resource-manager/Microsoft.Sql/preview/2024-05-01-preview/Servers.json output-folder: Generated diff --git a/src/Sql/Sql/ImportExport/Cmdlet/ImportExportCmdletArmBase.cs b/src/Sql/Sql/ImportExport/Cmdlet/ImportExportCmdletArmBase.cs index df0979649dde..ef3b86ab7cf0 100644 --- a/src/Sql/Sql/ImportExport/Cmdlet/ImportExportCmdletArmBase.cs +++ b/src/Sql/Sql/ImportExport/Cmdlet/ImportExportCmdletArmBase.cs @@ -80,8 +80,7 @@ public string AdministratorLogin /// /// Gets or sets the password of the SQL administrator /// - [Parameter(Mandatory = true, HelpMessage = "The Azure SQL Server administrator password")] - [ValidateNotNullOrEmpty] + [Parameter(Mandatory = false, HelpMessage = "The Azure SQL Server administrator password")] public SecureString AdministratorLoginPassword { get; set; diff --git a/src/Sql/Sql/ImportExport/Service/ImportExportDatabaseAdapter.cs b/src/Sql/Sql/ImportExport/Service/ImportExportDatabaseAdapter.cs index 5d263aa47976..706ded705ec4 100644 --- a/src/Sql/Sql/ImportExport/Service/ImportExportDatabaseAdapter.cs +++ b/src/Sql/Sql/ImportExport/Service/ImportExportDatabaseAdapter.cs @@ -59,7 +59,7 @@ public AzureSqlDatabaseImportExportBaseModel Export(AzureSqlDatabaseImportExport ExportDatabaseDefinition parameters = new ExportDatabaseDefinition() { AdministratorLogin = exportRequest.AdministratorLogin, - AdministratorLoginPassword = AzureSqlServerAdapter.Decrypt(exportRequest.AdministratorLoginPassword), + AdministratorLoginPassword = null, StorageKey = exportRequest.StorageKey, StorageKeyType = exportRequest.StorageKeyType.ToString(), StorageUri = exportRequest.StorageUri.ToString(), @@ -81,6 +81,11 @@ public AzureSqlDatabaseImportExportBaseModel Export(AzureSqlDatabaseImportExport parameters.AuthenticationType = exportRequest.AuthenticationType.ToString().ToLowerInvariant(); } + if (exportRequest.AuthenticationType != AuthenticationType.ManagedIdentity) + { + parameters.AdministratorLoginPassword = AzureSqlServerAdapter.Decrypt(exportRequest.AdministratorLoginPassword); + } + Uri azureAsyncOperation = null; ImportExportOperationResult response; @@ -104,7 +109,7 @@ public AzureSqlDatabaseImportExportBaseModel ImportNewDatabase(AzureSqlDatabaseI Management.Sql.Models.ImportNewDatabaseDefinition parameters = new Management.Sql.Models.ImportNewDatabaseDefinition() { AdministratorLogin = importRequest.AdministratorLogin, - AdministratorLoginPassword = AzureSqlServerAdapter.Decrypt(importRequest.AdministratorLoginPassword), + AdministratorLoginPassword = null, StorageKey = importRequest.StorageKey, StorageKeyType = importRequest.StorageKeyType.ToString(), StorageUri = importRequest.StorageUri.ToString(), @@ -124,6 +129,11 @@ public AzureSqlDatabaseImportExportBaseModel ImportNewDatabase(AzureSqlDatabaseI parameters.AuthenticationType = importRequest.AuthenticationType.ToString().ToLowerInvariant(); } + if (importRequest.AuthenticationType != AuthenticationType.ManagedIdentity) + { + parameters.AdministratorLoginPassword = AzureSqlServerAdapter.Decrypt(importRequest.AdministratorLoginPassword); + } + Uri azureAsyncOperation = null; ImportExportOperationResult response;